Don't allocate it IndexVec::remove
This commit is contained in:
parent
e1cd99f6ff
commit
bd1dfcebe3
1 changed files with 1 additions and 1 deletions
|
@ -460,7 +460,7 @@ impl<I: Idx, T> IndexVec<I, Option<T>> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn remove(&mut self, index: I) -> Option<T> {
|
pub fn remove(&mut self, index: I) -> Option<T> {
|
||||||
self.ensure_contains_elem(index, || None).take()
|
self.get_mut(index)?.take()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue