Skip to content

Commit

Permalink
Fix classification of nested breaks/ranges inside condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 1, 2025
1 parent 977a524 commit 4d1f6c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub(crate) fn confusable_with_adjacent_block(expr: &Expr) -> bool {
}
Expr::Break(e) => {
if let Some(value) = &e.expr {
confusable(value, true, true, rightmost_subexpression)
confusable(value, true, !allow_struct, rightmost_subexpression)
} else {
allow_struct && rightmost_subexpression
}
Expand Down Expand Up @@ -157,7 +157,9 @@ pub(crate) fn confusable_with_adjacent_block(expr: &Expr) -> bool {
}
None => false,
} || match &e.end {
Some(end) => confusable(end, allow_struct, true, rightmost_subexpression),
Some(end) => {
confusable(end, allow_struct, !allow_struct, rightmost_subexpression)
}
None => allow_struct && rightmost_subexpression,
})
}
Expand Down

0 comments on commit 4d1f6c0

Please sign in to comment.