Fix checked_get
This commit is contained in:
parent
a8f574bd80
commit
e9ef4db202
@ -510,8 +510,9 @@ impl<'a> Calculator<'a> {
|
||||
}
|
||||
|
||||
fn checked_get(&self, idx: usize) -> CalculatorResult<f64> {
|
||||
self.stack
|
||||
.get(idx)
|
||||
.ok_or(Err(CalculatorError::NotEnoughStackEntries))
|
||||
match self.stack.get(idx) {
|
||||
None => Err(CalculatorError::NotEnoughStackEntries),
|
||||
Some(r) => Ok(*r),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user