use expect instead of unwrap

This commit is contained in:
Kasey White 2022-07-24 19:47:13 -04:00 committed by Kasey White
parent 2a85567154
commit b3cb9c4510
1 changed files with 6 additions and 3 deletions

View File

@ -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) => {