Skip to content

Commit

Permalink
Merge pull request #1836 from dtolnay/castleft
Browse files Browse the repository at this point in the history
Disambiguate Expr::Cast precedence in scan_left
  • Loading branch information
dtolnay authored Jan 10, 2025
2 parents e4dfadc + 24ca4dd commit cd3fa5a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/fixup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ fn scan_left(expr: &Expr, fixup: FixupContext) -> bool {
Precedence::Assign => fixup.previous_operator <= Precedence::Assign,
binop_prec => fixup.previous_operator < binop_prec,
},
Expr::Cast(_) => fixup.previous_operator < Precedence::Cast,
Expr::Range(e) => e.start.is_none() || fixup.previous_operator < Precedence::Assign,
_ => true,
}
Expand Down

0 comments on commit cd3fa5a

Please sign in to comment.