Skip to content

Commit

Permalink
fix Recover::replace
Browse files Browse the repository at this point in the history
  • Loading branch information
pczarn committed Mar 6, 2016
1 parent d67cf45 commit ef87431
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libstd/collections/hash/map.rs
Expand Up @@ -1668,8 +1668,13 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
InternalEntry::Occupied { mut elem } => {
Some(mem::replace(elem.read_mut().0, key))
}
_ => {
None
other => {
if let Some(Vacant(vacant)) = other.into_entry(key) {
vacant.insert(());
None
} else {
unreachable!()
}
}
}
}
Expand Down

0 comments on commit ef87431

Please sign in to comment.