contradictory suggestion for labeled break with an unsafe block #142537
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Code
Current output
Desired output
Rationale and extra context
In the example, both match branches have contradictory suggestions: the top branch suggests to add parentheses around the
unsafe { ... }
, while the bottom branch suggests to remove the unnecessary parentheses.My intuition is that only vanilla blocks should trigger the lint in this postion, and that for
unsafe
it is sufficiently clear what the code does. e.g. this is invalidblk: unsafe { /* ... */ }
so there is no ambiguity.There is also not a loop in sight in my example, which also suggests that this lint is misapplied here.
A
const { }
expression only reports the unnecessary parens error.Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: