diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 5808b0b7748f4..e3f16a3c9ea45 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -57,18 +57,12 @@ pub trait AllocMap { /// Read-only lookup. fn get(&self, k: K) -> Option<&V> { - match self.get_or(k, || Err(())) { - Ok(v) => Some(v), - Err(()) => None, - } + self.get_or(k, || Err(())).ok() } /// Mutable lookup. fn get_mut(&mut self, k: K) -> Option<&mut V> { - match self.get_mut_or(k, || Err(())) { - Ok(v) => Some(v), - Err(()) => None, - } + self.get_mut_or(k, || Err(())).ok() } }