1
0
forked from bonsai/harakit

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

View File

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