Fix inherent impl overlap check.

This commit is contained in:
Camille GILLOT 2021-10-07 21:56:40 +02:00
parent 0157cc977f
commit a3f98a7501
3 changed files with 65 additions and 45 deletions

View file

@ -741,6 +741,12 @@ impl<I: Idx, T> IndexVec<I, Option<T>> {
self.ensure_contains_elem(index, || None);
self[index].get_or_insert_with(value)
}
#[inline]
pub fn remove(&mut self, index: I) -> Option<T> {
self.ensure_contains_elem(index, || None);
self[index].take()
}
}
impl<I: Idx, T: Clone> IndexVec<I, T> {