-
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
new lint: using let mut a = a
at start of function
#5102
Comments
Looks like a good first issue. Could this be assigned to me please? Thanks |
Hey guys, I'm on the last leg of the work ( My question is, how do I turn this from an error to a warning? Cheers |
Can you open a WIP PR, so I can have a look at the code and the dogfood error? |
I'm happy for any feedback on the overall change too. |
I'm willing to attempt to implement this and submit a PR if it would be accepted if @sonng isn't working on it. I expect to restart (to avoid merge conflicts) using their PR as a guide/inspiration? |
@brightly-salty Thanks! Yes you can use they're PR as inspiration. I think my comments on the PR should also help you with dos and don'ts. |
@rustbot claim |
I think this should probably be generalized to redefined locals as well. |
new lint: `redundant_locals` This lint checks for code like the following: ```rs let x = 1; let x = x; ``` It checks (afaik) all cases where a binding is shadowed by its own value in the same block, including function parameters. This has no effect and is almost certainly accidental, so it's in the `correctness` category like `self_assignment`. This also lays the groundwork for a more generalized version of #5102. changelog: new lint: [`redundant_local`]
Is this issue still relevant? It seems #10885 covered what have been requested here and we could close it. |
I inherited a codebase from someone new to Rust and there were lots of function definitions that looked like this:
It would be nice if there were a lint saying this would be better as
fn f(mut a: Vec<u8>)
instead.The text was updated successfully, but these errors were encountered: