Use expect (#9883)

This commit is contained in:
zhangyaning 2018-11-09 19:54:23 +08:00 committed by Andronik Ordian
parent 17effd15ab
commit d42d816e7f

View File

@ -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] {