-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`
Description
First reported upstream this code:
fn main() {
enum E {
A(i32,),
B(i32,),
}
match E::A(1) {
E::A(x) | E::B(x) => {}
}
}
when compiled yields a suggestion of
warning: unused variable: `x`
--> src/main.rs:7:14
|
7 | E::A(x) | E::B(x) => {}
| ^ help: consider using `_x` instead
|
= note: #[warn(unused_variables)] on by default
warning: variant is never constructed: `B`
--> src/main.rs:4:9
|
4 | B(i32),
| ^^^^^^
|
= note: #[warn(dead_code)] on by default
but the suggestion is not correct! Both instances of the x
binding need to be renamed in order for the code to be automatically fixed.
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-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`