Lint against useless &mut
(i.e., uplift clippy::unnecessary_mut_passed
)
#71493
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
In rust-analyzer, I had the following code:
I've changed the
compute_score
function toAfter that, the code compiled without warnings, was broken, because
compute_score(&mut completion_item, ctx);
statement no longer did what it was supposed to be doing.The smell here I think is that we use explicit
&mut
, which gets silently reborrowed to&
. I think we should lint against, roughly, all programs where&mut e
expression can be replaced with&e
without breaking the compilation.The text was updated successfully, but these errors were encountered: