We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
extend_reserve()
HashMap
1 parent c9aa259 commit e7fe2dfCopy full SHA for e7fe2df
library/std/src/collections/hash/map.rs
@@ -2786,15 +2786,7 @@ where
2786
2787
#[inline]
2788
fn extend_reserve(&mut self, additional: usize) {
2789
- // self.base.extend_reserve(additional);
2790
- // FIXME: hashbrown should implement this method.
2791
- // But until then, use the same reservation logic:
2792
-
2793
- // Reserve the entire hint lower bound if the map is empty.
2794
- // Otherwise reserve half the hint (rounded up), so the map
2795
- // will only resize twice in the worst case.
2796
- let reserve = if self.is_empty() { additional } else { (additional + 1) / 2 };
2797
- self.base.reserve(reserve);
+ self.base.extend_reserve(additional);
2798
}
2799
2800
0 commit comments