rust/tests/ui/let-else/accidental-if.rs
Edward Shen a8b77cfe54
Add suggestion to remove if in let...else block
Adds an additional hint to failures where we encounter an else keyword
while we're parsing an if-let block.

This is likely that the user has accidentally mixed if-let and let...else
together.
2023-01-23 20:33:04 -08:00

7 lines
140 B
Rust

fn main() {
let x = Some(123);
if let Some(y) = x else { //~ ERROR this `if` expression is missing a block
return;
};
}