Skip to content

Commit

Permalink
Don't allocate it IndexVec::remove
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Apr 18, 2023
1 parent e1cd99f commit bd1dfce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit bd1dfce

Please sign in to comment.