-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
needless_borrow false positive, with broken suggestion #8380
Comments
@rustbot modify labels +A-clippy +regression-from-stable-to-nightly |
FTR, my test case was with a fresh project made with
|
For my reference, this affects arti: https://gitlab.torproject.org/tpo/core/arti/-/issues/310 |
@rustbot label: -I-prioritize |
bors
added a commit
that referenced
this issue
Jun 28, 2022
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`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce
Run
cargo clippy
with this insrc/main.rs
:Output with current nightly (bad)
Discussion
The disagnostic is not correct. Changing the program as clippy suggests does not work (see comment in my example). Both nightly and stable reject the modified program.
Stable clippy IMO-rightly accepts the original program without complaint.
Meta
The text was updated successfully, but these errors were encountered: