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 {
|
let (x, y) = (
|
||||||
message: "Stack is empty.".to_string(),
|
&stack.pop_back().unwrap(),
|
||||||
})?;
|
&stack.pop_back().unwrap(),
|
||||||
|
);
|
||||||
let y = &stack.pop_back().ok_or(EvaluationError {
|
|
||||||
message: "Stack is empty.".to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
match op {
|
match op {
|
||||||
Add => &stack.push_back(y + x),
|
Add => &stack.push_back(y + x),
|
||||||
|
Loading…
Reference in New Issue
Block a user