Skip to content

Commit f633f69

Browse files
committed
Do not call reserve since extend will handle it.
`Take` implements `TrustedLen` so we are guaranteed that only one reserve call will be made.
1 parent c397252 commit f633f69

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

crates/ra_arena/src/map.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ pub struct ArenaMap<ID, V> {
1414
impl<T, V> ArenaMap<Idx<T>, V> {
1515
pub fn insert(&mut self, id: Idx<T>, t: V) {
1616
let idx = Self::to_idx(id);
17-
if self.v.capacity() <= idx {
18-
self.v.reserve(idx + 1 - self.v.capacity());
19-
}
2017

2118
let fill = (idx + 1).saturating_sub(self.v.len());
2219
self.v.extend(std::iter::repeat_with(|| None).take(fill));

0 commit comments

Comments
 (0)