]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoFixes for `branches_sharing_code`
Jason Newcomb [Fri, 8 Jul 2022 19:29:23 +0000 (15:29 -0400)]
Fixes for `branches_sharing_code`
* Don't suggest moving modifications to locals used in any of the condition expressions
* Don't suggest moving anything after a local with a significant drop

2 years agoAdd `for_each_expr`
Jason Newcomb [Fri, 8 Jul 2022 16:54:20 +0000 (12:54 -0400)]
Add `for_each_expr`

2 years agoAuto merge of #8958 - Alexendoo:simple_filter_map, r=giraffate
bors [Thu, 7 Jul 2022 23:39:12 +0000 (23:39 +0000)]
Auto merge of #8958 - Alexendoo:simple_filter_map, r=giraffate

Lint simple expressions in `manual_filter_map`, `manual_find_map`

changelog: Lint simple expressions in [`manual_filter_map`], [`manual_find_map`]

The current comparison rules out `.find(|a| a.is_some()).map(|b| b.unwrap())` because `a` being a reference can effect more complicated expressions, this adds a simple check for that case and adds the necessary derefs

There's some overlap with `option_filter_map` so `lint_filter_some_map_unwrap` now returns a `bool` to indicate it linted

2 years agoAuto merge of #9120 - anall:bugfix/ice9041, r=Jarcho
bors [Thu, 7 Jul 2022 23:04:29 +0000 (23:04 +0000)]
Auto merge of #9120 - anall:bugfix/ice9041, r=Jarcho

Fix ICE in sugg::DerefDelegate with (named) closures

rustc comiler internals helpfully tell us how to fix the issue:
```
  to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`
```
Fixes ICE in #9041

This also makes this code in `sugg::DerefDelegate` match a different use `typ.fn_sig(…)` I found: in `mixed_read_write_in_expression` -- being strict on the value of `typ.kind()` will hopefully reduce any future possibility of ICE crashes in this area.

---

changelog: none

2 years agoFix ICE in sugg::DerefDelegate with (named) closures
Andrea Nall [Mon, 4 Jul 2022 18:25:31 +0000 (13:25 -0500)]
Fix ICE in sugg::DerefDelegate with (named) closures

rustc comiler internals helpfully tell us how to fix the issue:

  to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`

Fixes ICE in #9041

2 years agoAuto merge of #9132 - hellow554:maybe_trait_bound_on_type_repetition, r=Manishearth
bors [Thu, 7 Jul 2022 15:29:43 +0000 (15:29 +0000)]
Auto merge of #9132 - hellow554:maybe_trait_bound_on_type_repetition, r=Manishearth

Maybe trait bound on type repetition

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: fix maybe trait on [`type_repetition_in_bounds`] lint

I simplified the two for loops, which did exactly the same. Only downside is, that I need a `copied`, but that's to convert from `&&` to `&`, to that should be a noop?

One more thing: I only handle [`TraitBoundModifier::Maybe`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TraitBoundModifier.html#variant.Maybe). Can anyone give me an example (and testcase) for [`TraitBoundModifier::MaybeConst`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TraitBoundModifier.html#variant.MaybeConst)?

closes #8770

2 years agoLint simple expressions in manual_filter_map, manual_find_map
Alex Macleod [Mon, 6 Jun 2022 15:09:37 +0000 (15:09 +0000)]
Lint simple expressions in manual_filter_map, manual_find_map

2 years agofix incorrect suggestion for maybe trait bounds
Marcel Hellwig [Thu, 7 Jul 2022 10:24:17 +0000 (12:24 +0200)]
fix incorrect suggestion for maybe trait bounds

2 years agotrait_bounds: rework two loops into one
Marcel Hellwig [Thu, 7 Jul 2022 09:59:55 +0000 (11:59 +0200)]
trait_bounds: rework two loops into one

the two loops did practically the same, only the type were different (&&
vs &), so I used `copied` to convert `&&` and chained them together.
Instead of parsing the trait info manually, I use the already provided
method `get_trait_info_from_bound`.
Also, instead of using manual string writing, I used `join` by
`itertools`.

2 years agoAuto merge of #9096 - Jarcho:needless_borrow_subs, r=Manishearth
bors [Wed, 6 Jul 2022 21:26:46 +0000 (21:26 +0000)]
Auto merge of #9096 - Jarcho:needless_borrow_subs, r=Manishearth

Fix `needless_borrow` 9095

fixes #9095
changelog: Don't lint `needless_borrow` on method receivers when it would change which trait impl is called

2 years agoAuto merge of #9099 - joshtriplett:unnecessary-lazy-eval-then-some, r=flip1995
bors [Wed, 6 Jul 2022 09:20:55 +0000 (09:20 +0000)]
Auto merge of #9099 - joshtriplett:unnecessary-lazy-eval-then-some, r=flip1995

Extend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`

fixes #9097

changelog: Extend `unnecessary_lazy_eval` to convert `bool::then` to `bool::then_some`

2 years agoDogfood fixes to use `bool::then_some`
Josh Triplett [Wed, 6 Jul 2022 07:52:53 +0000 (00:52 -0700)]
Dogfood fixes to use `bool::then_some`

2 years agoAdd MSRV check for `bool::then_some`
Josh Triplett [Wed, 6 Jul 2022 07:51:40 +0000 (00:51 -0700)]
Add MSRV check for `bool::then_some`

2 years agoExtend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`
Josh Triplett [Sat, 2 Jul 2022 22:00:24 +0000 (15:00 -0700)]
Extend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`

2 years agoAuto merge of #9124 - Jarcho:shadow_ice, r=Alexendoo
bors [Tue, 5 Jul 2022 20:04:14 +0000 (20:04 +0000)]
Auto merge of #9124 - Jarcho:shadow_ice, r=Alexendoo

Lint `shadow_*` lints in anon const blocks

changelog: Lint `shadow_*` lints in anon const blocks

2 years agoLint `shadow_*` lints in anon const blocks
Jason Newcomb [Tue, 5 Jul 2022 19:21:27 +0000 (15:21 -0400)]
Lint `shadow_*` lints in anon const blocks

2 years agoAuto merge of #9121 - alex-semenyuk:fix_ui_test_cast_32_bits, r=flip1995
bors [Tue, 5 Jul 2022 08:57:12 +0000 (08:57 +0000)]
Auto merge of #9121 - alex-semenyuk:fix_ui_test_cast_32_bits, r=flip1995

Fix stderr for cast_size_32bit

changelog: fix stderr for cast_size_32bit

2 years agoFix stderr for cast_size_32bit
alexey semenyuk [Tue, 5 Jul 2022 06:43:29 +0000 (09:43 +0300)]
Fix stderr for cast_size_32bit

2 years agoAuto merge of #9117 - Jarcho:unsafe_block_closure, r=giraffate
bors [Tue, 5 Jul 2022 00:20:33 +0000 (00:20 +0000)]
Auto merge of #9117 - Jarcho:unsafe_block_closure, r=giraffate

Fix `undocumented_unsafe_blocks` in closures

fixes #9114
changelog: Fix `undocumented_unsafe_blocks` not checking for comments before the start of a closure

2 years agoAuto merge of #9115 - Alexendoo:new-with-const-generics, r=llogiq
bors [Mon, 4 Jul 2022 18:19:37 +0000 (18:19 +0000)]
Auto merge of #9115 - Alexendoo:new-with-const-generics, r=llogiq

`new_without_default`: ignore const generics/lifetime params on `fn new`

Fixes #9113

No longer lints if `fn new` has any params

changelog: [`new_without_default`]: no longer lints const generics and lifetime params on `fn new`

2 years agoFix `undocumented_unsafe_blocks` in closures
Jason Newcomb [Mon, 4 Jul 2022 17:53:42 +0000 (13:53 -0400)]
Fix `undocumented_unsafe_blocks` in closures

2 years agonew_without_default: ignore const generics/lifetime params on fn new
Alex Macleod [Mon, 4 Jul 2022 14:03:11 +0000 (14:03 +0000)]
new_without_default: ignore const generics/lifetime params on fn new

2 years agoAuto merge of #9093 - Jarcho:deref_ice, r=giraffate
bors [Mon, 4 Jul 2022 00:22:17 +0000 (00:22 +0000)]
Auto merge of #9093 - Jarcho:deref_ice, r=giraffate

Fix ICE in `dereference.rs`

fixes #9089
changelog: Fix ICE when dereferencing or borrowing on explicit returns from closures

2 years agoAuto merge of #9105 - Serial-ATA:lint-invalid-utf8, r=Jarcho
bors [Sun, 3 Jul 2022 20:02:38 +0000 (20:02 +0000)]
Auto merge of #9105 - Serial-ATA:lint-invalid-utf8, r=Jarcho

Add `invalid_utf8_in_unchecked`

changelog: Add [`invalid_utf8_in_unchecked`]
closes: #629

Don't know how useful of a lint this is, just saw this was a really old issue :smile:.

2 years agoAdd `invalid_utf8_in_unchecked`
Serial [Sun, 3 Jul 2022 02:24:26 +0000 (22:24 -0400)]
Add `invalid_utf8_in_unchecked`

2 years agoAuto merge of #9110 - alex-semenyuk:fix_trailling_commas, r=xFrednet
bors [Sun, 3 Jul 2022 19:33:01 +0000 (19:33 +0000)]
Auto merge of #9110 - alex-semenyuk:fix_trailling_commas, r=xFrednet

Remove trailing spaces

Closes #9108
changelog: remove trailing spaces,  which are not allowed by the JSON standard.

2 years agoFixed comment
alexey semenyuk [Sun, 3 Jul 2022 19:03:51 +0000 (19:03 +0000)]
Fixed comment

2 years agoAuto merge of #9112 - xFrednet:9088-fix-lint-versions, r=Jarcho
bors [Sun, 3 Jul 2022 18:41:54 +0000 (18:41 +0000)]
Auto merge of #9112 - xFrednet:9088-fix-lint-versions, r=Jarcho

Correct `[clippy::version]` for 1.62 lints and add note to docs

closes: https://github.com/rust-lang/rust-clippy/issues/9088

changelog: none

---

It feels weird to have such a short PR description. So, what should I add to this one... Yes, art:

```txt
 ,-----.,--.,--.
'  .--./|  |`--' ,---.  ,---.,--. ,--.
|  |    |  |,--.| .-. || .-. |\  '  /
'  '--'\|  ||  || '-' '| '-' ' \   '
 `-----'`--'`--'|  |-' |  |-'.-'  /
                `--'   `--'  `---'
```

```txt
 ,-----.,--.   ,--.,------. ,------.,--.   ,--.
'  .--./|  |   |  ||  .--. '|  .--. '\  `.'  /
|  |    |  |   |  ||  '--' ||  '--' | '.    /
'  '--'\|  '--.|  ||  | --' |  | --'    |  |
 `-----'`-----'`--'`--'     `--'        `--'
```

```txt
   _____ _      _____ _____  _______     __
  / ____| |    |_   _|  __ \|  __ \ \   / /
 | |    | |      | | | |__) | |__) \ \_/ /
 | |    | |      | | |  ___/|  ___/ \   /
 | |____| |____ _| |_| |    | |      | |
  \_____|______|_____|_|    |_|      |_|
```

2 years agoCorrect `[clippy::version]` for 1.62 lints and add note to docs
xFrednet [Sun, 3 Jul 2022 15:02:48 +0000 (17:02 +0200)]
Correct `[clippy::version]` for 1.62 lints and add note to docs

2 years agoRemove trailing spaces
alexey semenyuk [Sun, 3 Jul 2022 14:44:09 +0000 (17:44 +0300)]
Remove trailing spaces

2 years agoAuto merge of #9106 - usefulmove:master, r=flip1995
bors [Sun, 3 Jul 2022 13:10:07 +0000 (13:10 +0000)]
Auto merge of #9106 - usefulmove:master, r=flip1995

corrected README.md book link

This change corrects the book link on the Clippy Book README.md.

changelog: none

2 years agocorrected README.md book link
Duane [Sun, 3 Jul 2022 03:41:58 +0000 (20:41 -0700)]
corrected README.md book link

2 years agoUse correct substitutions when checking if `needless_borrow` can apply to a method...
Jason Newcomb [Sat, 2 Jul 2022 19:32:29 +0000 (15:32 -0400)]
Use correct substitutions when checking if `needless_borrow` can apply to a method receiver

2 years agoFix ICE in `dereference.rs`
Jason Newcomb [Sat, 2 Jul 2022 04:59:58 +0000 (00:59 -0400)]
Fix ICE in `dereference.rs`

2 years agoAuto merge of #9087 - alex-semenyuk:fix_link, r=llogiq
bors [Fri, 1 Jul 2022 18:39:54 +0000 (18:39 +0000)]
Auto merge of #9087 - alex-semenyuk:fix_link, r=llogiq

Fix broken link

changelog: none

2 years agoFix link
alexey semenyuk [Fri, 1 Jul 2022 18:31:57 +0000 (18:31 +0000)]
Fix link

2 years agoAuto merge of #9085 - xFrednet:9081-update-format-push-version, r=Manishearth,flip1995
bors [Fri, 1 Jul 2022 16:51:34 +0000 (16:51 +0000)]
Auto merge of #9085 - xFrednet:9081-update-format-push-version, r=Manishearth,flip1995

Correct lint version for `format_push_string`

Closes #9081

changelog: none

IDK what else to say. Look I can draw an ascii penguin =D:

```
 (^v^)
<(   )>
  w w
```

2 years agoCorrect lint version for `format_push_string`
xFrednet [Fri, 1 Jul 2022 16:05:45 +0000 (18:05 +0200)]
Correct lint version for `format_push_string`

2 years agoAuto merge of #9082 - Alexendoo:let_unit_allow, r=xFrednet
bors [Fri, 1 Jul 2022 15:51:41 +0000 (15:51 +0000)]
Auto merge of #9082 - Alexendoo:let_unit_allow, r=xFrednet

Fix direct `#[allow]` attributes in `let_unit_value`

Fixes part of #9080

Not sure why it doesn't work when the lint is emitted at the statement, but switching it to the local works fine

changelog: Fix direct `#[allow]` attributes in [`let_unit_value`]

2 years agoAuto merge of #9083 - giraffate:fix_link_in_changelog, r=flip1995
bors [Fri, 1 Jul 2022 12:55:38 +0000 (12:55 +0000)]
Auto merge of #9083 - giraffate:fix_link_in_changelog, r=flip1995

Fix some links

changelog: none

2 years agoFix some links
Takayuki Nakata [Fri, 1 Jul 2022 12:30:59 +0000 (21:30 +0900)]
Fix some links

2 years agoFix allow attributes in let_unit_value
Alex Macleod [Fri, 1 Jul 2022 12:08:28 +0000 (12:08 +0000)]
Fix allow attributes in let_unit_value

2 years agoAuto merge of #9039 - Serial-ATA:dev-dogfood, r=giraffate
bors [Fri, 1 Jul 2022 01:07:25 +0000 (01:07 +0000)]
Auto merge of #9039 - Serial-ATA:dev-dogfood, r=giraffate

Add `cargo dev dogfood`

changelog: Add `cargo dev dogfood`

Part of #5394

2 years agoAuto merge of #9075 - Serial-ATA:update-docs, r=flip1995
bors [Thu, 30 Jun 2022 20:55:04 +0000 (20:55 +0000)]
Auto merge of #9075 - Serial-ATA:update-docs, r=flip1995

Add `dev deprecate` to the development basics

changelog: none

2 years agoAuto merge of #9078 - hamza1311:patch-1, r=xFrednet
bors [Thu, 30 Jun 2022 19:24:50 +0000 (19:24 +0000)]
Auto merge of #9078 - hamza1311:patch-1, r=xFrednet

Fix broken hyperlink in documentation

changelog: none

The hyperlinks in [`is_digit_ascii_radix`](https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix)'s docs are broken. This PR fixes those.

2 years agoFix broken hyperlink
Muhammad Hamza [Thu, 30 Jun 2022 19:14:38 +0000 (00:14 +0500)]
Fix broken hyperlink

2 years agoAuto merge of #9058 - xFrednet:changelog-1-62, r=flip1995
bors [Thu, 30 Jun 2022 17:33:33 +0000 (17:33 +0000)]
Auto merge of #9058 - xFrednet:changelog-1-62, r=flip1995

Changelog for Rust 1.62 :t-rex:

This special artifact was just discovered. The artifact details changes to something called Clippy. Presently and from the context, we were unable to determine what this is supposed to be. All we know, is that it seems to have an active community around it which supports it. The members sometimes use paper clips as a secret symbol for Clippy.

I want to donate this artifact to the rust-lang organization, to have it displayed to the public.

---

changelog: none

2 years agoAdd `dev deprecate` to the development basics
Serial [Thu, 30 Jun 2022 16:45:48 +0000 (12:45 -0400)]
Add `dev deprecate` to the development basics

2 years agoAuto merge of #9074 - daxpedda:equatable-if-let-external-macro, r=Manishearth
bors [Thu, 30 Jun 2022 16:24:03 +0000 (16:24 +0000)]
Auto merge of #9074 - daxpedda:equatable-if-let-external-macro, r=Manishearth

Fix false-positive in `equatable_if_let`

Was linting in external macros. I guess now that I know about https://github.com/rust-lang/rust-clippy/pull/8694 it seems all kinda pointless until we resolve that.

Nevertheless, it's an improvement.

Fixes #9066.

changelog:`equatable_if_let` No longer lint on macros

2 years agoFix false-positive in `equatable_if_let`
dAxpeDDa [Thu, 30 Jun 2022 15:45:34 +0000 (17:45 +0200)]
Fix false-positive in `equatable_if_let`

2 years agoAuto merge of #9071 - Alexendoo:8734, r=dswij
bors [Thu, 30 Jun 2022 10:43:39 +0000 (10:43 +0000)]
Auto merge of #9071 - Alexendoo:8734, r=dswij

Uncomment test for #8734

I believe the issue was an interaction between rustfix and `span_lint_and_sugg_for_edges`, so this would've been fixed by https://github.com/rust-lang/rust/pull/98261 (Thanks, `@WaffleLapkin!)`

Closes #8734

changelog: none

2 years agoAuto merge of #9070 - flip1995:ci-fix, r=xFrednet
bors [Thu, 30 Jun 2022 10:27:24 +0000 (10:27 +0000)]
Auto merge of #9070 - flip1995:ci-fix, r=xFrednet

Make sure bors success depends on metadata_collection

r? `@xFrednet`

Currently bors runs the `metadata_collection` but merges before the run is finished, because the bors success dummy step didn't depend on it. This also makes sure that the `metadata_collection` test is run at the same time as the other base runs to not produce overhead.

changelog: none

2 years agoUncomment test for #8734
Alex Macleod [Thu, 30 Jun 2022 10:13:54 +0000 (10:13 +0000)]
Uncomment test for #8734

2 years agoMake sure bors success depends on metadata_collection
Philipp Krones [Thu, 30 Jun 2022 09:37:48 +0000 (11:37 +0200)]
Make sure bors success depends on metadata_collection

2 years agoAuto merge of #9069 - flip1995:rustup, r=flip1995
bors [Thu, 30 Jun 2022 08:32:54 +0000 (08:32 +0000)]
Auto merge of #9069 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump Clippy version -> 0.1.64
Philipp Krones [Thu, 30 Jun 2022 08:29:22 +0000 (10:29 +0200)]
Bump Clippy version -> 0.1.64

2 years agoBump nightly version -> 2022-06-30
Philipp Krones [Thu, 30 Jun 2022 08:28:58 +0000 (10:28 +0200)]
Bump nightly version -> 2022-06-30

2 years agoFix dogfood
Philipp Krones [Thu, 30 Jun 2022 08:28:04 +0000 (10:28 +0200)]
Fix dogfood

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 30 Jun 2022 08:27:25 +0000 (10:27 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #9068 - tamaroning:fix-typo-2022-6-30, r=giraffate,xFrednet
bors [Thu, 30 Jun 2022 06:18:19 +0000 (06:18 +0000)]
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

2 years agoUpdate large_const_arrays.rs
tamaron [Thu, 30 Jun 2022 04:21:17 +0000 (13:21 +0900)]
Update large_const_arrays.rs

2 years agoAuto merge of #8666 - Jarcho:while_let_loop_7913, r=dswij
bors [Thu, 30 Jun 2022 04:04:08 +0000 (04:04 +0000)]
Auto merge of #8666 - Jarcho:while_let_loop_7913, r=dswij

Don't lint `while_let_loop` when significant drop order would change

fixes #7226
fixes #7913
fixes #5717

For #5717 it may not stay fully fixed. This is only completely fixed right now due to all the allowed drop impls have `#[may_dangle]` on their drop impls. This may get changed in the future based on how significant drops are determined, but the example listed with `RefCell` shouldn't break.

changelog: Don't lint `while_let_loop` when the order of significant drops would change

2 years agofix
tamaron [Thu, 30 Jun 2022 02:59:23 +0000 (11:59 +0900)]
fix

2 years agoAdd `dev dogfood` to the book
Serial [Thu, 30 Jun 2022 02:42:58 +0000 (22:42 -0400)]
Add `dev dogfood` to the book

2 years agoDon't lint `while_let_loop` when drop order would change
Jason Newcomb [Fri, 8 Apr 2022 17:21:04 +0000 (13:21 -0400)]
Don't lint `while_let_loop` when drop order would change

2 years agoExtract util functions from `redundant_pattern_match`
Jason Newcomb [Fri, 8 Apr 2022 16:55:48 +0000 (12:55 -0400)]
Extract util functions from `redundant_pattern_match`

2 years agoAuto merge of #9043 - dswij:9037-test, r=Manishearth
bors [Wed, 29 Jun 2022 15:09:37 +0000 (15:09 +0000)]
Auto merge of #9043 - dswij:9037-test, r=Manishearth

`extra_unused_lifetimes` add FP test case emitting from derived attributes.

Add test to cover for #9014 which is fixed in #9037.

changelog: [`extra_unused_lifetimes`] Add FP test case emitting from derived attributes.

---

Seeing the FP from the test:

```sh
$ git revert -m 1 1d1ae10876d3eaa5c982dd3daa083b7c2fc363b9
$ TESTNAME=extra_unused_lifetime cargo uitest
```

2 years agoAuto merge of #8981 - PrestonFrom:more_details_for_significant_drop_lint, r=flip1995
bors [Wed, 29 Jun 2022 13:23:21 +0000 (13:23 +0000)]
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.

2 years agoAuto merge of #9046 - xFrednet:rust-97660-expection-something-something, r=Jarcho
bors [Tue, 28 Jun 2022 18:28:38 +0000 (18:28 +0000)]
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

2 years agoAuto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995
bors [Tue, 28 Jun 2022 18:09:26 +0000 (18:09 +0000)]
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`

2 years agoAuto merge of #8921 - Jarcho:merge_passes, r=llogiq
bors [Tue, 28 Jun 2022 17:24:06 +0000 (17:24 +0000)]
Auto merge of #8921 - Jarcho:merge_passes, r=llogiq

Add `Operators` lint pass

changelog: None

2 years agoMove `SelfAssignment` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 14:43:02 +0000 (10:43 -0400)]
Move `SelfAssignment` into `Operators` lint pass

2 years agoFix dogfood
Jason Newcomb [Tue, 14 Jun 2022 15:44:43 +0000 (11:44 -0400)]
Fix dogfood

2 years agoMove `PtrEq` into `Operators` lin pass
Jason Newcomb [Wed, 1 Jun 2022 14:37:37 +0000 (10:37 -0400)]
Move `PtrEq` into `Operators` lin pass

2 years agoMove `NeedlessBitwiseBool` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 14:12:26 +0000 (10:12 -0400)]
Move `NeedlessBitwiseBool` into `Operators` lint pass

2 years agoMove `ModuloArithmetic` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 13:50:33 +0000 (09:50 -0400)]
Move `ModuloArithmetic` into `Operators` lint pass

2 years agoMove some lints from `Misc` to `Operators`
Jason Newcomb [Wed, 1 Jun 2022 06:06:12 +0000 (02:06 -0400)]
Move some lints from `Misc` to `Operators`

2 years agoMove `IntegerDivision` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:33:06 +0000 (01:33 -0400)]
Move `IntegerDivision` into `Operators` lint pass

2 years agoMove `IdentityOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:23:57 +0000 (01:23 -0400)]
Move `IdentityOp` into `Operators` lint pass

2 years agoMove `FloatEqualityWithoutAbs` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:06:56 +0000 (01:06 -0400)]
Move `FloatEqualityWithoutAbs` into `Operators` lint pass

2 years agoMove `ErasingOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 03:47:59 +0000 (23:47 -0400)]
Move `ErasingOp` into `Operators` lint pass

2 years agoMove `EqOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 03:39:00 +0000 (23:39 -0400)]
Move `EqOp` into `Operators` lint pass

2 years agoMove `DurationSubsec` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:48:17 +0000 (22:48 -0400)]
Move `DurationSubsec` into `Operators` lint pass

2 years agoMove `DoubleComparison` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:32:13 +0000 (22:32 -0400)]
Move `DoubleComparison` into `Operators` lint pass

2 years agoMove `BitMask` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:14:43 +0000 (22:14 -0400)]
Move `BitMask` into `Operators` lint pass

2 years agoMove `AssignOps` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 01:57:32 +0000 (21:57 -0400)]
Move `AssignOps` into `Operators` lint pass

2 years agoMove `Arithmetic` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 01:27:29 +0000 (21:27 -0400)]
Move `Arithmetic` into `Operators` lint pass

2 years agoAdd `Operators` lint pass
Jason Newcomb [Tue, 31 May 2022 18:07:50 +0000 (14:07 -0400)]
Add `Operators` lint pass

2 years agoAdd `explicit_auto_deref` test for variadic function
Jason Newcomb [Mon, 13 Jun 2022 17:09:52 +0000 (13:09 -0400)]
Add `explicit_auto_deref` test for variadic function

2 years agoCode cleanup
Jason Newcomb [Mon, 7 Feb 2022 15:29:45 +0000 (10:29 -0500)]
Code cleanup

2 years agoHandle future precedence issues in `explicit_auto_deref` + cleanup
Jason Newcomb [Mon, 31 Jan 2022 07:06:18 +0000 (02:06 -0500)]
Handle future precedence issues in `explicit_auto_deref` + cleanup

2 years agoFix `needless_borrow` suggestion when calling a trait method taking `self`
Jason Newcomb [Sun, 30 Jan 2022 01:29:43 +0000 (20:29 -0500)]
Fix `needless_borrow` suggestion when calling a trait method taking `self`

2 years agoRefactor `dereference.rs`
Jason Newcomb [Sat, 29 Jan 2022 23:06:14 +0000 (18:06 -0500)]
Refactor `dereference.rs`

Merge `Position` and `AutoDerefStability`

2 years agoLint `explicit_auto_deref` immediately after `needless_borrow`
Jason Newcomb [Sat, 29 Jan 2022 14:36:46 +0000 (09:36 -0500)]
Lint `explicit_auto_deref` immediately after `needless_borrow`

2 years agoLint `explicit_auto_deref` without a leading borrow
Jason Newcomb [Fri, 28 Jan 2022 19:54:28 +0000 (14:54 -0500)]
Lint `explicit_auto_deref` without a leading borrow

2 years agoOnly check parent node once in `dereference.rs`
Jason Newcomb [Fri, 28 Jan 2022 15:56:20 +0000 (10:56 -0500)]
Only check parent node once in `dereference.rs`

2 years agoLint field accesses in `explicit_auto_deref`
Jason Newcomb [Fri, 28 Jan 2022 14:12:34 +0000 (09:12 -0500)]
Lint field accesses in `explicit_auto_deref`

2 years agoMerge different parent walking loops in `dereference.rs`
Jason Newcomb [Fri, 28 Jan 2022 01:03:50 +0000 (20:03 -0500)]
Merge different parent walking loops in `dereference.rs`

`needless_borrow` will now walk further to find the target type.

2 years agoDon't lint `explicit_auto_deref` on reborrows
Jason Newcomb [Thu, 27 Jan 2022 15:17:14 +0000 (10:17 -0500)]
Don't lint `explicit_auto_deref` on reborrows

2 years agoAdd `explicit_auto_deref` lint
Jason Newcomb [Thu, 27 Jan 2022 03:47:09 +0000 (22:47 -0500)]
Add `explicit_auto_deref` lint