1
0
Fork 0

rpn(1): more code cleanup

This commit is contained in:
Emma Tebibyte 2024-02-01 10:54:28 -07:00
parent 34b9519e03
commit f7108245ea
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270
1 changed files with 4 additions and 7 deletions

View File

@ -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),