Closed
Description
Code
fn main() {
for _ in [1, 2, 3].iter()map(|x| x) {}
}
Current output
error: expected `{`, found `map`
--> src/main.rs:2:30
|
2 | for _ in [1, 2, 3].iter()map(|x| x) {}
| ^^^ expected `{`
|
help: try placing this code inside a block
|
2 | for _ in [1, 2, 3].iter(){ map(|x| x) } {}
| + +
Desired output
error: expected `{`, found `map`
--> src/main.rs:2:30
|
2 | for _ in [1, 2, 3].iter()map(|x| x) {}
| ^^^ expected `{`
|
help: you might have meant to call a method
|
2 | for _ in [1, 2, 3].iter().map(|x| x) {}
| +
Rationale and extra context
No response
Other cases
No response
Rust Version
1.82
Anything else?
No response
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: A structured suggestion resulting in incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.