-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
The compiler gives no warning for a forward-declared variable which need not be mutable.
This code:
let mut x = 5;
let y = x + 10;
println!("{}", y);yields a warning:
<anon>:2:9: 2:14 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
<anon>:2 let mut x = 5;
^~~~~While this code does not:
let mut x;
x = 5;
let y = x + 10;
println!("{}", y);Meta
rustc --version --verbose:
rustc 1.0.0 (a59de37 2015-05-13) (built 2015-05-14)
binary: rustc
commit-hash: a59de37
commit-date: 2015-05-13
build-date: 2015-05-14
host: x86_64-unknown-linux-gnu
release: 1.0.0
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints