Description
Hello.
The following code gives an error message that could be improved:
fn main() {
let n = 1;
if 5 == {
println!("five");
}
}
It gives the following error:
src/main.rs:6:1: 6:2 error: expected `{`, found `}`
src/main.rs:6 }
^
src/main.rs:6:1: 6:2 help: place this code inside a block
This is because the compiler sees the right operand as a block expression, and is looking for the condition body, something like:
fn main() {
let n = 1;
if 5 == {
println!("five");
5
} {
println!("Five");
}
}
while we most probably mean to write something like:
fn main() {
let n = 1;
if 5 == n {
println!("five");
}
}
So, it would be nice to improve this error message.