mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
fix Recover::replace
This commit is contained in:
@@ -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!()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user