Code
fn main() {
let mut x = 1;
x = 2;
x = 3;
println!("{x}");
}
Current output
warning: value assigned to `x` is never read
--> src/main.rs:2:13
|
2 | let mut x = 1;
| ^
|
= help: maybe it is overwritten before being read?
= note: `#[warn(unused_assignments)]` on by default
warning: value assigned to `x` is never read
--> src/main.rs:3:5
|
3 | x = 2;
| ^
|
= help: maybe it is overwritten before being read?
Desired output
warning: value assigned to `x` is never read
--> src/main.rs:2:13
|
2 | let mut x = 1;
| ^
3 | x = 2;
| - overwritten here before being read
= note: `#[warn(unused_assignments)]` on by default
warning: value assigned to `x` is never read
--> src/main.rs:3:5
|
3 | x = 2;
| ^
4 | x = 3;
| - overwritten here before being read
Rationale and extra context
No response
Other cases
Rust Version
1.88 + 1.90-nightly as of today
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
No response
Other cases
Rust Version
Anything else?
No response