diff --git a/src/tools/miri/src/data_structures/mono_hash_map.rs b/src/tools/miri/src/data_structures/mono_hash_map.rs index 220233f8ff5f..63edfdac9d60 100644 --- a/src/tools/miri/src/data_structures/mono_hash_map.rs +++ b/src/tools/miri/src/data_structures/mono_hash_map.rs @@ -96,10 +96,7 @@ fn get_or(&self, k: K, vacant: impl FnOnce() -> Result) -> Result<&V, E /// Read-only lookup (avoid read-acquiring the RefCell). fn get(&self, k: K) -> Option<&V> { - let val: *const V = match self.0.borrow().get(&k) { - Some(v) => &**v, - None => return None, - }; + let val: *const V = &**self.0.borrow().get(&k)?; // This is safe because `val` points into a `Box`, that we know will not move and // will also not be dropped as long as the shared reference `self` is live. unsafe { Some(&*val) }