Skip to content

Commit

Permalink
replace match by ok()
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 28, 2019
1 parent c119291 commit 0e602f1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/librustc_mir/interpret/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,12 @@ pub trait AllocMap<K: Hash + Eq, V> {

/// 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()
}
}

Expand Down

0 comments on commit 0e602f1

Please sign in to comment.