Skip to content

Commit

Permalink
Improve precedence variant name of sum and product operators
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 6, 2024
1 parent 06f34fc commit 0f72134
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/precedence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ pub(crate) enum Precedence {
// << >>
Shift,
// + -
Arithmetic,
Sum,
// * / %
Term,
Product,
// as
Cast,
// unary - * ! & &mut
Expand All @@ -44,8 +44,8 @@ pub(crate) enum Precedence {
impl Precedence {
pub(crate) fn of_binop(op: &BinOp) -> Self {
match op {
BinOp::Add(_) | BinOp::Sub(_) => Precedence::Arithmetic,
BinOp::Mul(_) | BinOp::Div(_) | BinOp::Rem(_) => Precedence::Term,
BinOp::Add(_) | BinOp::Sub(_) => Precedence::Sum,
BinOp::Mul(_) | BinOp::Div(_) | BinOp::Rem(_) => Precedence::Product,
BinOp::And(_) => Precedence::And,
BinOp::Or(_) => Precedence::Or,
BinOp::BitXor(_) => Precedence::BitXor,
Expand Down

0 comments on commit 0f72134

Please sign in to comment.