mirror of https://github.com/rust-lang/rust.git
Don't allocate it `IndexVec::remove`
This commit is contained in:
parent
e1cd99f6ff
commit
bd1dfcebe3
|
@ -460,7 +460,7 @@ impl<I: Idx, T> IndexVec<I, Option<T>> {
|
|||
|
||||
#[inline]
|
||||
pub fn remove(&mut self, index: I) -> Option<T> {
|
||||
self.ensure_contains_elem(index, || None).take()
|
||||
self.get_mut(index)?.take()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue