-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-type-systemArea: Type systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.
Description
From @jruderman 's comment on #1832:
IMO, the "unused" warning should be per-assignment, not per-variable.
fn main() {
let mut x = 10;
x = 20;
log(error, x);
}
should warn because the first assignment to x is unused.
fn main() {
let mut x = 10;
log(error, x);
x = 20;
}
should warn because the second assignment to x is unused. Finally, the original example,
fn main() {
let mut x = 10, y = 20;
x <-> y;
log(error, y);
}
should warn because the second assignment to x is unused.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-type-systemArea: Type systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.