Put the capacity check back in

This commit is contained in:
Gwilym Inzani 2023-05-23 21:29:05 +01:00
parent 903157325f
commit 9ec0836da9

View file

@ -339,6 +339,10 @@ where
} }
unsafe fn insert_new_and_get(&mut self, key: K, value: V, hash: HashType) -> &'_ mut V { unsafe fn insert_new_and_get(&mut self, key: K, value: V, hash: HashType) -> &'_ mut V {
if self.nodes.capacity() <= self.len() {
self.resize(self.nodes.backing_vec_size() * 2);
}
let location = self.nodes.insert_new(key, value, hash); let location = self.nodes.insert_new(key, value, hash);
// SAFETY: location is always valid // SAFETY: location is always valid