We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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);
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
rustc --version --verbose
The text was updated successfully, but these errors were encountered:
This is interesting, I bet it's because x=5 is always treated as mutation, regardless.
x=5
Sorry, something went wrong.
a18d984
No branches or pull requests
The compiler gives no warning for a forward-declared variable which need not be mutable.
This code:
yields a warning:
While this code does not:
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
The text was updated successfully, but these errors were encountered: