diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-02-01 19:59:38 -0330 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-02-01 19:59:38 -0330 |
| commit | 7dbfa917fb9ff770f4d8cf5a1578c92d669b36df (patch) | |
| tree | 153c2bf2c41a4f4c2d39c849070084f2ba662220 | |
| parent | d6baba41e0e5190190edc34ef887dcab6e0c929b (diff) | |
| download | pfc-7dbfa917fb9ff770f4d8cf5a1578c92d669b36df.zip | |
make match expression more concise
| -rw-r--r-- | src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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), + }); } } |