-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
A-lintArea: New lintsArea: New lintsT-middleType: Probably requires verifiying typesType: Probably requires verifiying types
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
SOF3
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsT-middleType: Probably requires verifiying typesType: Probably requires verifiying types