Open
Description
Idea: Add a lint for unneeded mutable borrows when an immutable borrow suffices:
fn main() {
let m = &mut 21; // `&21` would suffice
println!("{}", m);
}
This lint could also catch an unneeded ref mut
when a plain ref
suffices:
fn main() {
let test = &mut Test{a: 1};
let &mut Test{ ref mut a } = test;
println!("{}", a);
}
struct Test {
a: i32,
}
cc @oli-obk