Closed
Description
Hi! Clippy in the Rust Playground spots this problem:
fn foo(x: &u32) {
let _y = x;
}
fn main() {
foo(&mut 10);
}
warning: The function/method `foo` doesn't need a mutable reference
note: `#[warn(clippy::unnecessary_mut_passed)]` on by default
But it doesn't find the inverted problem here:
fn foo(x: &mut u32) { // This doesn't need to take a mut
let _y = x;
}
fn main() {
foo(&mut 10);
}
While this is caught by Rustc too:
fn foo(mut x: u32) {
let _y = x;
}
fn main() {
foo(10);
}
warning: variable does not need to be mutable