forked from bonsai/harakit
rpn(1): more code cleanup
This commit is contained in:
parent
34b9519e03
commit
f7108245ea
11
src/rpn.rs
11
src/rpn.rs
@ -142,13 +142,10 @@ fn eval(
|
||||
})
|
||||
},
|
||||
_ => {
|
||||
let x = &stack.pop_back().ok_or(EvaluationError {
|
||||
message: "Stack is empty.".to_string(),
|
||||
})?;
|
||||
|
||||
let y = &stack.pop_back().ok_or(EvaluationError {
|
||||
message: "Stack is empty.".to_string(),
|
||||
})?;
|
||||
let (x, y) = (
|
||||
&stack.pop_back().unwrap(),
|
||||
&stack.pop_back().unwrap(),
|
||||
);
|
||||
|
||||
match op {
|
||||
Add => &stack.push_back(y + x),
|
||||
|
Loading…
Reference in New Issue
Block a user