-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
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
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions