We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c119291 commit 0e602f1Copy full SHA for 0e602f1
src/librustc_mir/interpret/machine.rs
@@ -57,18 +57,12 @@ pub trait AllocMap<K: Hash + Eq, V> {
57
58
/// Read-only lookup.
59
fn get(&self, k: K) -> Option<&V> {
60
- match self.get_or(k, || Err(())) {
61
- Ok(v) => Some(v),
62
- Err(()) => None,
63
- }
+ self.get_or(k, || Err(())).ok()
64
}
65
66
/// Mutable lookup.
67
fn get_mut(&mut self, k: K) -> Option<&mut V> {
68
- match self.get_mut_or(k, || Err(())) {
69
70
71
+ self.get_mut_or(k, || Err(())).ok()
72
73
74
0 commit comments