-
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: suggest removing several references at a time. #5327
Comments
Hi, this is already implemented but you have to opt-in manually ( #[warn(clippy::needless_borrow)]
fn main() {
let st = String::from("zomg");
myfunc(&&&&&st);
}
fn myfunc(param: &str) {
println!("param: {}", param);
} should make clippy warn about it. :) |
@matthiaskrgr is there a way to opt in with a CLI argument? Also, how do I list all linters/detectors? |
@matthiaskrgr Also, the suggestion given is not the best one and applying it and re-running
seems like something to be improved |
Mhh, looks like the lint only looks at one reference at a time.. 🤔 EDIT: link -> lint |
All lints are listed here: https://rust-lang.github.io/rust-clippy/ Just choose the version of Clippy you're using and it will show you all lints in this version with their documentation. (master ~= nightly) |
Hey,
It would be nice if Clippy could detect needless references as in here:
The
myfunc(&&&&&st);
should bemyfunc(&st);
.Side note: there is a similar, needless lifetime parameter detecting, that would trigger in e.g.
fn myfunc<'a>(param: &'a str)
The text was updated successfully, but these errors were encountered: