-
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
in this example:
fn foo() -> Result<(), ()> {
Ok(())
}
fn main() {
let mut a = None;
loop {
let b = foo();
if b.is_ok() {
a = Some(b);
break;
}
}
println!("{:?}", a.unwrap().unwrap());
}output: (on stable rustc 1.21.0 and nightly rustc 1.23.0-nightly)
Compiling ressai v0.1.0 (file:///home/thiolliere/developpement/ressai)
warning: value assigned to `a` is never read
--> main.rs:6:9
|
6 | let mut a = None;
| ^^^^^
|
= note: #[warn(unused_assignments)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 0.60 secs
Running `/home/thiolliere/developpement/ressai/target/debug/ressai`
()
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.