Skip to content

Commit

Permalink
Fix parenthesization of chained comparisons containing bailout
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 10, 2025
1 parent fd198d9 commit 4944362
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fixup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ fn scan_right(
return Scan::Consume;
}
let binop_prec = Precedence::of_binop(&e.op);
if binop_prec == Precedence::Compare && fixup.next_operator == Precedence::Compare {
return Scan::Consume;
}
let right_fixup = fixup.rightmost_subexpression_fixup(false, false, binop_prec);
let scan = scan_right(
&e.right,
Expand Down

0 comments on commit 4944362

Please sign in to comment.