use expect instead of unwrap
This commit is contained in:
parent
2a85567154
commit
b3cb9c4510
|
@ -103,10 +103,13 @@ impl Machine {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn return_compute(&mut self, value: Value) -> Result<Term<NamedDeBruijn>, Error> {
|
fn return_compute(&mut self, value: Value) -> Result<Term<NamedDeBruijn>, Error> {
|
||||||
// avoid unwrap if possible and just return an err when None
|
// frames should never be empty anyways because Machine
|
||||||
// but honestly it should never be empty anyways because Machine
|
|
||||||
// is initialized with `Context::NoFrame`.
|
// is initialized with `Context::NoFrame`.
|
||||||
let frame = self.frames.last().cloned().unwrap();
|
let frame = self
|
||||||
|
.frames
|
||||||
|
.last()
|
||||||
|
.cloned()
|
||||||
|
.expect("frames should never be empty");
|
||||||
|
|
||||||
match frame {
|
match frame {
|
||||||
Context::FrameApplyFun(function) => {
|
Context::FrameApplyFun(function) => {
|
||||||
|
|
Loading…
Reference in New Issue