Closed
Description
Given
fn foo(b: bool, x: Option<u32>) {
if b && if let Some(x) = x {}
}
fn main() {
if true && if true { true }
}
error: expected `{`, found `}`
--> src/main.rs:3:1
|
3 | }
| ^ expected `{`
|
note: the `if` expression is missing a block after this condition
--> src/main.rs:2:8
|
2 | if b && if let Some(x) = x {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: expected `{`, found `}`
--> src/main.rs:6:1
|
6 | }
| ^ expected `{`
|
note: the `if` expression is missing a block after this condition
--> src/main.rs:5:8
|
5 | if true && if true { true }
| ^^^^^^^^^^^^^^^^^^^^^^^^
We should detect that what was intended was
fn foo(b: bool, x: Option<u32>) {
if b && let Some(x) = x {}
}
fn main() {
if true && true { true }
}
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: An error or lint that needs small tweaks.`#![feature(let_chains)]`Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.