-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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.C-bugCategory: This is a bug.Category: This is a bug.
Description
i get this warning: warning: value assigned to `valid` is never read
This is the code:
fn main() {
let mut valid = true;
while valid {
valid = false;
println!("Bye!");
continue;
}
println!("Hello, world!");
}
The warning is:
warning: value assigned to `valid` is never read
--> src/main.rs:4:9
|
4 | valid = false;
| ^^^^^
|
= note: #[warn(unused_assignments)] on by default
value valid is said not to be read, but it is read as the while condition will be executed after the continue invocation.
tested via rust playground on stable, beta and nightly.
aside from the warning, the program behaves correctly
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.C-bugCategory: This is a bug.Category: This is a bug.