Closed
Description
#![allow(unreachable_code)]
fn f() -> bool {
loop {
if (break { return true }) {
}
}
false
}
fn g() -> bool {
loop {
if break { return true } {
}
}
false
}
fn main() {
println!("f={} g={}", f(), g());
}
f=true g=false
Rustc 1.30.0-nightly (bb0896a 2018-09-29) suggests turning f
into g
, which changes the meaning of the program.
```warning: unnecessary parentheses around `if` condition
--> src/main.rs:5:12
|
5 | if (break { return true }) {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
= note: #[warn(unused_parens)] on by default