Use expect (#9883)
This commit is contained in:
parent
17effd15ab
commit
d42d816e7f
@ -66,11 +66,7 @@ impl<S : fmt::Display> Stack<S> for VecStack<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn pop_back(&mut self) -> S {
|
fn pop_back(&mut self) -> S {
|
||||||
let val = self.stack.pop();
|
self.stack.pop().expect("instruction validation prevents from popping too many items; qed")
|
||||||
match val {
|
|
||||||
Some(x) => x,
|
|
||||||
None => panic!("Tried to pop from empty stack.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pop_n(&mut self, no_of_elems: usize) -> &[S] {
|
fn pop_n(&mut self, no_of_elems: usize) -> &[S] {
|
||||||
|
Loading…
Reference in New Issue
Block a user