Commit Graph

13224 Commits

Author SHA1 Message Date
Georgy Komarov
467a0bfdea matches: Restore match_type logic; add tests for these cases 2022-01-26 18:20:35 +03:00
Georgy Komarov
81015870df matches: Improve naming. NFC. 2022-01-26 18:02:32 +03:00
Georgy Komarov
4aee3b1f1e matches: Clarify the behavior of exhaustive check 2022-01-26 14:46:48 +03:00
Georgy Komarov
5416a71dae Merge remote-tracking branch 'origin/master' into 8282-single-match 2022-01-26 14:16:15 +03:00
bors
a26c412e28 Auto merge of #8343 - robjtede:patch-1, r=giraffate
Autofocus search input

changelog: autofocus filter input on Clippy Lints page
2022-01-25 13:08:10 +00:00
Rob Ede
a8e1352d78
Autofocus search input 2022-01-25 00:15:11 +00:00
bors
60d3597cd2 Auto merge of #8315 - dswij:8306, r=giraffate
`trait_duplication_in_bounds` checks path segments for trait items

closes #8306

changelog: [`trait_duplication_in_bounds`] Fix FP when path segments exists for trait items
2022-01-24 00:03:40 +00:00
bors
d976d8ad87 Auto merge of #8311 - dswij:8277, r=llogiq
fix `needless_question_mark` not considering async fn

closes #8277

changelog: [`needless_question_mark`] Fix FN on async functions
2022-01-23 12:59:52 +00:00
dswij
a05276620c fix needless_question_mark not considering async fn 2022-01-23 20:31:27 +08:00
bors
788a8bc740 Auto merge of #8217 - Jarcho:needless_borrow_8191, r=camsteffen
Fix `needless_borrow` causing mutable borrows to be moved

fixes #8191

changelog: Fix `needless_borrow` causing mutable borrows to be moved
changelog: Rename `ref_in_deref` to `needless_borrow`
changelog: Suggest removing the borrow on method call receivers in `needless_borrow`
2022-01-23 03:01:39 +00:00
Jason Newcomb
c61514086d Subsume ref_in_deref into needless_borrow 2022-01-22 21:22:33 -05:00
Jason Newcomb
9e9110e4f3 Remove final reference on fields and method calls in needless_borrow 2022-01-22 20:35:32 -05:00
bors
1e546c5d79 Auto merge of #8278 - Alexendoo:needless-lifetime-explicit-self-ty, r=xFrednet
`needless_lifetimes`: ignore lifetimes in explicit self types

changelog: false positive fix: [`needless_lifetimes`] no longer lints lifetimes in explicit self types

They're not currently elidable (https://github.com/rust-lang/rust/issues/69064)

Fixes #7296
2022-01-22 13:00:39 +00:00
Alex Macleod
9ef6e2199c needless_lifetimes: ignore lifetimes in explicit self types 2022-01-22 12:27:57 +00:00
bors
acfc161fa6 Auto merge of #8332 - Jarcho:clear_test_results, r=camsteffen
Don't bless outdated files on windows

changelog: None
2022-01-22 04:49:41 +00:00
Jason Newcomb
7ed29c0051 Don't bless outdated files on windows 2022-01-21 23:13:09 -05:00
bors
4992548f28 Auto merge of #8271 - Jarcho:ptr_arg_214, r=flip1995
Check usages in `ptr_arg`

fixes #214
fixes #1981
fixes #3381
fixes #6406
fixes #6964

This does not take into account the return type of the function currently, so `(&Vec<_>) -> &Vec<_>` functions may still be false positives.

The name given for the type also has to match the real type name, so `type Foo = Vec<u32>` won't trigger the lint, but `type Vec = Vec<u32>` will. I'm not sure if this is the best way to handle this, or if a note about the actual type should be added instead.

changelog: Check if the argument is used in a way which requires the original type in `ptr_arg`
changelog: Lint mutable references in `ptr_arg`
2022-01-21 15:43:57 +00:00
Jason Newcomb
15c068ed0f Fix needless_borrow causing mutable borrows to be moved 2022-01-21 09:50:11 -05:00
Jason Newcomb
048297b5b2 ptr_arg cleanup 2022-01-21 09:43:41 -05:00
bors
f4709e6f1d Auto merge of #8329 - Alexendoo:enum-variant-names, r=giraffate
Don't suggest an empty variant name in `enum_variant_names`

changelog: false positive fix: [`enum_variant_names`]: No longer suggests an empty variant name

Fixes #8324
2022-01-21 13:37:18 +00:00
Alex Macleod
7c563175c7 Don't suggest an empty variant name in enum_variant_names 2022-01-21 13:10:19 +00:00
Georgy Komarov
49ae73b450 matches: Simplify code 2022-01-21 07:28:40 +03:00
Georgy Komarov
a0c5087520 single_match: Clarify the don't lint test case 2022-01-21 07:28:26 +03:00
Georgy Komarov
a5a07e503f single_match: Don't lint non-exhaustive matches; support tuples
This commit changes the behavior of `single_match` lint.

After that, we won't lint non-exhaustive matches like this:

```rust
match Some(v) {
    Some(a) => println!("${:?}", a),
    None => {},
}
```

The rationale is that, because the type of `a` could be changed, so the
user can get non-exhaustive match after applying the suggested lint (see
https://github.com/rust-lang/rust-clippy/issues/8282#issuecomment-1013566068
for context).

We also will lint `match` constructions with tuples. When we see the
tuples on the both arms, we will check them both at the same time, and
if they form exhaustive match, we could display the warning.

Closes #8282
2022-01-20 15:14:25 +03:00
dswij
4c1549ecc8 trait_duplication_in_bounds checks path segments for trait items 2022-01-20 13:38:48 +08:00
bors
8bb4690487 Auto merge of #8280 - xFrednet:8276-map-clone-msrv, r=flip1995
Add `msrv` config for `map_clone`

Just a small PR to have some fun with Clippy and to clear my head a bit 😅

---

changelog: [`map_clone`]: The suggestion takes `msrv` into account
changelog: Track `msrv` attribute for `manual_bits` and `borrow_as_prt`

fixes: #8276
2022-01-19 16:33:10 +00:00
bors
0b143e347c Auto merge of #8304 - camsteffen:test-tweaks, r=flip1995
Remove __CLIPPY_INTERNAL_TESTS env var

changelog: none

It doesn't have any effect AFAICT.
2022-01-19 08:55:40 +00:00
bors
16032c53c9 Auto merge of #8310 - camelid:rm-stringification, r=Manishearth
Remove unnecessary `Symbol` stringification

This should (slightly) improve performance and enhance code quality.

changelog: none
2022-01-19 01:23:15 +00:00
Noah Lev
d9f401a53a Remove unnecessary Symbol stringification
This should (slightly) improve performance and enhance code quality.
2022-01-18 17:03:33 -08:00
bors
fff8e78f6d Auto merge of #8298 - ebobrow:op_ref_fp, r=giraffate
fix op_ref false positive

fixes #7572

changelog: `op_ref` don't lint for unnecessary reference in BinOp impl if removing the reference will lead to unconditional recursion
2022-01-18 00:12:42 +00:00
Cameron Steffen
3afbae33ab Remove __CLIPPY_INTERNAL_TESTS env var 2022-01-17 12:37:05 -06:00
bors
8d14c94b5c Auto merge of #8292 - marekdownar:8239, r=xFrednet
issue #8239: Printed hint for lint or_fun_call is cropped and does no…

fixes rust-lang/rust-clippy#8239

changelog: [`or_fun_call`]: if suggestion contains more lines than MAX_SUGGESTION_HIGHLIGHT_LINES it is stripped to one line
2022-01-17 12:08:30 +00:00
bors
72c59fda27 Auto merge of #8302 - xFrednet:0000-move-return-self-not-must-use, r=flip1995
Move `return_self_not_must_use` to `pedantic`

r? `@flip1995`

changelog: none
2022-01-17 11:35:58 +00:00
xFrednet
2d3eb5082a
Move return_self_not_must_use to pedantic 2022-01-17 12:35:19 +01:00
Marek Downar
69d78ceeba
removing unsafe from test fn's && renaming shrink to sugg_span 2022-01-17 12:34:03 +01:00
bors
d364d8ad5b Auto merge of #8299 - marekdownar:8214, r=Manishearth
#8214 cmp_owned suggestion flips the comparison

changelog: ``[`cmp_owned`]`` fixes #8214 so that the suggestion does not flip the comparison
2022-01-17 07:04:06 +00:00
bors
537a7f3e44 Auto merge of #8297 - Jarcho:if_same_then_else_7579, r=Manishearth
Don't lint `if_same_then_else` with `if let` conditions

fixes #7579

changelog: Don't lint `if_same_then_else` with `if let` conditions
2022-01-17 06:48:01 +00:00
Jason Newcomb
5461ed670e Don't lint if_same_then_else with if let conditions 2022-01-16 18:39:46 -05:00
bors
93cad4a94d Auto merge of #8203 - pmnoxx:piotr-next-lint, r=llogiq
New lint: `iter_overeager_cloned`

Closes #8202

changelog: New lint: [`iter_overeager_cloned`]
2022-01-16 20:02:28 +00:00
Marek Downar
5b6ec8c57d
#8214 cmp_owned suggestion flips the comparison 2022-01-16 20:27:00 +01:00
Piotr Mikulski
36396c6b97 Fix tests 2022-01-16 10:33:30 -08:00
Piotr Mikulski
d48d247309 Fix clippy warnings 2022-01-16 10:19:48 -08:00
Piotr Mikulski
1c9b31d350 New line: cloned_next 2022-01-16 09:59:29 -08:00
Elliot Bobrow
fb5f51d3eb fix op_ref false positive 2022-01-16 09:20:33 -08:00
bors
0d27bd846c Auto merge of #8295 - Jarcho:useless_format_8290, r=giraffate
Handle implicit named arguments in `useless_format`

fixes #8290

Ideally this would fix the macro parsing code to handle this, but this is a smaller change and easier to back port.

changelog: Handle implicit named arguments in `useless_format`
2022-01-16 13:24:08 +00:00
bors
d61f798aac Auto merge of #8284 - xFrednet:0000-update-copyright-year-i-am-procrastinating, r=giraffate
Update copyright year for Clippy (2022 edition)

At this point, I'm just searching for small things to do instead of sleeping or working on my bachelor thesis. 😅  Taking one day off will be fine 🙃

changelog: none
2022-01-16 12:33:08 +00:00
bors
27845a9205 Auto merge of #8274 - andrewarchi:master, r=camsteffen
Update markdown-it version

Fixes improperly-escaped pipes in Markdown tables for the [documentation of bad_bit_mask](https://rust-lang.github.io/rust-clippy/master/index.html#bad_bit_mask) and [ineffective_bit_mask](https://rust-lang.github.io/rust-clippy/master/index.html#ineffective_bit_mask). A column pipe takes precedence over inline code markers, so some back ticks are displayed literally and the pipes need to be escaped. I found no other occurrences of the same problem when searching rust-clippy by ```\|.*`.*\|```.

changelog: Update markdown-it version
2022-01-15 22:17:37 +00:00
Jason Newcomb
cb384ff03b Handle implicit named arguments in useless_format 2022-01-15 16:28:49 -05:00
Marek Downar
49502727e7
issue #8239: fix to prev commit && 4 test cases 2022-01-15 22:19:01 +01:00
Marek Downar
ee84ac3396
issue #8239: Printed hint for lint or_fun_call is cropped and does not show the solution 2022-01-15 15:51:46 +01:00