Correctly initialise to 16 elements

This commit is contained in:
Gwilym Kuiper 2022-03-17 23:51:01 +00:00
parent bfdca7117d
commit c0d9f0ab41

View file

@ -1,7 +1,7 @@
use alloc::{vec, vec::Vec};
use alloc::vec::Vec;
use core::{
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
mem,
iter, mem,
};
use rustc_hash::FxHasher;
@ -46,10 +46,7 @@ impl<K, V> HashMap<K, V> {
Self {
number_of_elements: 0,
max_distance_to_initial_bucket: 0,
nodes: vec![
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None,
],
nodes: iter::repeat_with(|| None).take(16).collect(),
hasher: Default::default(),
}
}