Closed
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.