You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example, there's a single expression inside curly braces. I think clippy should detect that because it is probably not intended. (We have some of these in our codebase due to refactor.)
Lint Name
unecessary_curly_braces
Category
style
Advantage
Remove lines of code
Removes indentation
(Improves readability)
Drawbacks
No response
Example
let a = {if cond {None}else{Some(5)}};
Better:
let a = if cond {None}else{Some(5)};
The text was updated successfully, but these errors were encountered:
Hey, thanks for reporting. There’s already a lint at the rustc level: unused_braces. Unfortunately it only triggers on one-line braces, but there’s a PR to expand it, although it’s been stalled on review: rust-lang/rust#102432
What it does
In the following example, there's a single expression inside curly braces. I think clippy should detect that because it is probably not intended. (We have some of these in our codebase due to refactor.)
Lint Name
unecessary_curly_braces
Category
style
Advantage
Drawbacks
No response
Example
Better:
The text was updated successfully, but these errors were encountered: