aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2023-02-01 19:59:38 -0330
committerSam Anthony <sam@samanthony.xyz>2023-02-01 19:59:38 -0330
commit7dbfa917fb9ff770f4d8cf5a1578c92d669b36df (patch)
tree153c2bf2c41a4f4c2d39c849070084f2ba662220
parentd6baba41e0e5190190edc34ef887dcab6e0c929b (diff)
downloadpfc-7dbfa917fb9ff770f4d8cf5a1578c92d669b36df.zip
make match expression more concise
-rw-r--r--src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c623af2..8bd62ba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,13 +26,13 @@ impl Calculator {
return;
}
};
- match op {
- Operator::Add => self.stack.push(lhs + rhs),
- Operator::Sub => self.stack.push(lhs - rhs),
- Operator::Mul => self.stack.push(lhs * rhs),
- Operator::Div => self.stack.push(lhs / rhs),
- Operator::Exp => self.stack.push(lhs.powf(rhs)),
- }
+ self.stack.push(match op {
+ Operator::Add => lhs + rhs,
+ Operator::Sub => lhs - rhs,
+ Operator::Mul => lhs * rhs,
+ Operator::Div => lhs / rhs,
+ Operator::Exp => lhs.powf(rhs),
+ });
}
}