From 49443622bd2ff2986554ca58d7ee13436d784c22 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 9 Jan 2025 17:11:12 -0800 Subject: [PATCH] Fix parenthesization of chained comparisons containing bailout --- src/fixup.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fixup.rs b/src/fixup.rs index 2576ec365..e49f81131 100644 --- a/src/fixup.rs +++ b/src/fixup.rs @@ -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,