Commit Graph

7783 Commits

Author SHA1 Message Date
Philipp Krones
f26cf11fe8
Merge remote-tracking branch 'upstream/master' into rustup 2022-06-30 10:27:25 +02:00
bors
ff3964af1b Auto merge of #9068 - tamaroning:fix-typo-2022-6-30, r=giraffate,xFrednet
fix typo in Clippy Lints page

https://rust-lang.github.io/rust-clippy/master/#significant_drop_in_scrutinee

changelog: none
2022-06-30 06:18:19 +00:00
tamaron
5d9e1b6f00 Update large_const_arrays.rs 2022-06-30 13:21:17 +09:00
tamaron
5d75a9bd4c fix 2022-06-30 11:59:23 +09:00
Jason Newcomb
adbc8499d3 Don't lint while_let_loop when drop order would change 2022-06-29 13:43:05 -04:00
Jason Newcomb
58434ae385 Extract util functions from redundant_pattern_match 2022-06-29 13:42:59 -04:00
bors
90227c10f7 Auto merge of #8981 - PrestonFrom:more_details_for_significant_drop_lint, r=flip1995
Add details about how significant drop in match scrutinees can cause deadlocks

Adds more details about how a significant drop in a match scrutinee can cause a deadlock and include link to documentation.

changelog: Add more details to significant drop lint to explicitly show how temporaries in match scrutinees can cause deadlocks.
2022-06-29 13:23:21 +00:00
bors
4995b4e584 Auto merge of #9046 - xFrednet:rust-97660-expection-something-something, r=Jarcho
Fix `#[expect]` for most clippy lints

This PR fixes most `#[expect]` - lint interactions listed in rust-lang/rust#97660. [My comment in the issue](https://github.com/rust-lang/rust/issues/97660#issuecomment-1147269504) shows the current progress (Once this is merged). I plan to work on `duplicate_mod` and `multiple_inherent_impl` and leave the rest for later. I feel like stabilizing the feature is more important than fixing the last few nits, which currently also don't work with `#[allow]`.

---

changelog: none

r? `@Jarcho`

cc: rust-lang/rust#97660
2022-06-28 18:28:38 +00:00
bors
a4130e1612 Auto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995
Add lint `explicit_auto_deref` take 2

fixes: #234
fixes: #8367
fixes: #8380

Still things to do:

* ~~This currently only lints `&*<expr>` when it doesn't trigger `needless_borrow`.~~
* ~~This requires a borrow after a deref to trigger. So `*<expr>` changing `&&T` to `&T` won't be caught.~~
* The `deref` and `deref_mut` trait methods aren't linted.
* Neither ~~field accesses~~, nor method receivers are linted.
* ~~This probably shouldn't lint reborrowing.~~
* Full slicing to deref should probably be handled here as well. e.g. `&vec[..]` when just `&vec` would do

changelog: new lint `explicit_auto_deref`
2022-06-28 18:09:26 +00:00
Jason Newcomb
ffbba8550a Move SelfAssignment into Operators lint pass 2022-06-28 13:03:08 -04:00
Jason Newcomb
5e2a2d3ac9 Fix dogfood 2022-06-28 13:02:08 -04:00
Jason Newcomb
92891a01a1 Move PtrEq into Operators lin pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
fc5eac5894 Move NeedlessBitwiseBool into Operators lint pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
71c2daa60a Move ModuloArithmetic into Operators lint pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
c0b0ee5bdc Move some lints from Misc to Operators 2022-06-28 12:51:30 -04:00
Jason Newcomb
a8df16ae1d Move IntegerDivision into Operators lint pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
83de67cfec Move IdentityOp into Operators lint pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
56f50d36e7 Move FloatEqualityWithoutAbs into Operators lint pass 2022-06-28 12:51:29 -04:00
Jason Newcomb
3de70a4996 Move ErasingOp into Operators lint pass 2022-06-28 12:51:29 -04:00
Jason Newcomb
0adb3c0518 Move EqOp into Operators lint pass 2022-06-28 12:51:29 -04:00
Jason Newcomb
732d7162ab Move DurationSubsec into Operators lint pass 2022-06-28 12:51:29 -04:00
Jason Newcomb
4ac3626f2e Move DoubleComparison into Operators lint pass 2022-06-28 12:51:29 -04:00
Jason Newcomb
68a7fd22ad Move BitMask into Operators lint pass 2022-06-28 12:51:26 -04:00
Jason Newcomb
751131b4ac Move AssignOps into Operators lint pass 2022-06-28 12:51:03 -04:00
Jason Newcomb
448b6f45bd Move Arithmetic into Operators lint pass 2022-06-28 12:51:00 -04:00
Jason Newcomb
dd78ce7bbe Add Operators lint pass 2022-06-28 12:50:33 -04:00
Jason Newcomb
15df2289ea Code cleanup 2022-06-28 12:48:49 -04:00
Jason Newcomb
9788107931 Handle future precedence issues in explicit_auto_deref + cleanup 2022-06-28 12:48:27 -04:00
Jason Newcomb
6d21b79be9 Fix needless_borrow suggestion when calling a trait method taking self 2022-06-28 12:48:27 -04:00
Jason Newcomb
0b4ba734cb Refactor dereference.rs
Merge `Position` and `AutoDerefStability`
2022-06-28 12:48:26 -04:00
Jason Newcomb
0204b95357 Lint explicit_auto_deref immediately after needless_borrow 2022-06-28 12:48:26 -04:00
Jason Newcomb
65bc6cb8bf Lint explicit_auto_deref without a leading borrow 2022-06-28 12:48:26 -04:00
Jason Newcomb
442a68c64b Only check parent node once in dereference.rs 2022-06-28 12:48:26 -04:00
Jason Newcomb
20ea26234a Lint field accesses in explicit_auto_deref 2022-06-28 12:48:26 -04:00
Jason Newcomb
a187d6412b Merge different parent walking loops in dereference.rs
`needless_borrow` will now walk further to find the target type.
2022-06-28 12:48:26 -04:00
Jason Newcomb
ee532c0222 Don't lint explicit_auto_deref on reborrows 2022-06-28 12:48:26 -04:00
Jason Newcomb
8a74d33570 Add explicit_auto_deref lint 2022-06-28 12:48:24 -04:00
bors
b776fb8294 Auto merge of #8774 - hellow554:cargo-rust-version, r=flip1995
try reading rust-version from Cargo.toml

Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry

changelog: respect `rust-version` from `Cargo.toml`

closes #8746
closes #7765
2022-06-28 07:27:08 +00:00
bors
373bb573af Auto merge of #8639 - Jarcho:trivially_copy_pass_by_ref_5953, r=dswij
`trivially_copy_pass_by_ref` fixes

fixes #5953
fixes #2961

The fix for #5953 is overly aggressive, but the suggestion is so bad that it's worth the false negatives. Basically three things together:
* It's not obviously wrong
* It compiles
* It may actually work when tested

changelog: Don't lint `trivially_copy_pass_by_ref` when unsafe pointers are used.
changelog: Better track lifetimes when linting `trivially_copy_pass_by_ref`.
2022-06-28 07:03:57 +00:00
Marcel Hellwig
81737bf850 try reading rust-version from Cargo.toml
Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry
2022-06-28 08:01:50 +02:00
Preston From
7bc40967a4 Run cargo dev fmt 2022-06-27 23:01:47 -06:00
Preston From
3cfd1e5233 Make messages more accurate, check lint enabled 2022-06-27 22:52:22 -06:00
bors
d85539571f Auto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq
Fix example `SELF_ASSIGNMENT`

changelog: Fix example in `SELF_ASSIGNMENT` docs
2022-06-27 17:33:31 +00:00
bors
fdd0e727e2 Auto merge of #8649 - ebobrow:imperative_find, r=flip1995
add [`manual_find`] lint for function return case

part of the implementation discussed in #7143

changelog: add [`manual_find`] lint for function return case
2022-06-27 17:15:25 +00:00
Jason Newcomb
c10101cf1c Don't lint trivially_copy_pass_by_ref when unsafe pointers are used 2022-06-27 13:14:27 -04:00
Jason Newcomb
2315f76f9d Actually check lifetimes in trivially_copy_pass_by_ref 2022-06-27 13:14:25 -04:00
alexey semenyuk
c6a2221393 Fix example SELF_ASSIGNMENT 2022-06-27 18:21:09 +03:00
bors
eaa03ea911 Auto merge of #8972 - kyoto7250:use_retain, r=llogiq
feat(new lint): new lint `manual_retain`

close #8097

This PR is  a new  lint implementation.
This lint checks if the `retain` method is available.

Thank you in advance.

changelog: add new ``[`manual_retain`]`` lint
2022-06-27 13:58:26 +00:00
Klim Tsoutsman
65f700fa89
Fix let_undescore_lock false-positive when binding without locking
Signed-off-by: Klim Tsoutsman <klimusha@gmail.com>
2022-06-27 20:35:26 +10:00
bors
6b762ee330 Auto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate
STRING_ADD example

changelog: none
STRING_ADD example, how it should be
2022-06-27 06:08:00 +00:00