fix Recover::replace

This commit is contained in:
Piotr Czarnecki
2016-03-06 12:24:18 +01:00
parent d67cf45d22
commit ef874310f2
+7 -2
View File
@@ -1668,8 +1668,13 @@ fn replace(&mut self, key: K) -> Option<K> {
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!()
}
}
}
}