Fix checked_get

This commit is contained in:
Austen Adler 2021-04-29 20:53:03 -04:00
parent a8f574bd80
commit e9ef4db202

View File

@ -510,8 +510,9 @@ impl<'a> Calculator<'a> {
} }
fn checked_get(&self, idx: usize) -> CalculatorResult<f64> { fn checked_get(&self, idx: usize) -> CalculatorResult<f64> {
self.stack match self.stack.get(idx) {
.get(idx) None => Err(CalculatorError::NotEnoughStackEntries),
.ok_or(Err(CalculatorError::NotEnoughStackEntries)) Some(r) => Ok(*r),
}
} }
} }