diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-04-17 13:37:03 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-04-18 12:55:54 +0000 |
| commit | bd1dfcebe3ae34c4c7fb2ac0660707090a0cbe3a (patch) | |
| tree | ec21f66b3904abc1be98e174ea13bdefede517ea | |
| parent | e1cd99f6ff2bc2aecec530801b8a71d898bff309 (diff) | |
| download | rust-bd1dfcebe3ae34c4c7fb2ac0660707090a0cbe3a.tar.gz rust-bd1dfcebe3ae34c4c7fb2ac0660707090a0cbe3a.zip | |
Don't allocate it `IndexVec::remove`
| -rw-r--r-- | compiler/rustc_index/src/vec.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 95600f7bcf1..18e779f786e 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -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() } } |
