From a44b8a4013e82ebd7eff9c45bcca30d59ff255a0 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sun, 2 Oct 2022 19:00:59 +0100 Subject: [PATCH] Add comment explaining the `continue` statement --- agb/src/hash_map.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index 9a73c4a8..e338a17e 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -758,6 +758,10 @@ impl NodeStorage { if let Some((k, v)) = node.key_value_mut() { if !f(k, v) { self.remove_from_location(i); + + // Need to continue before adding 1 to i because remove from location could + // put the element which was next into the ith location in the nodes array, + // so we need to check if that one needs removing too. continue; } }