From c0d9f0ab415091e1c58ae24d5ad40a1f632e238e Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Thu, 17 Mar 2022 23:51:01 +0000 Subject: [PATCH] Correctly initialise to 16 elements --- agb/src/hash_map.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index 3ea08233..c691765e 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -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 HashMap { 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(), } }