Closed
Description
Not quite sure how to name this issue, please change the title to something more accurate!
Recently ran into this issue:
fn main() {
let b = false; // dangerous semi-colon
|| true;
println!("{}", b);
}
The boolean statement was long, so I broke it out onto a new line. However, I accidentally added the annotated semi-colon. The || true
line is interpreted as an anonymous closure statement (no let binding, not even a callable closure) as opposed to a boolean OR.
When executing this code, it yields false
. Luckily, someone caught the issue in code review, but a compiler warning noting the unused closure would have been really helpful!