Add comment explaining the continue statement

This commit is contained in:
Gwilym Kuiper 2022-10-02 19:00:59 +01:00
parent 01862901c2
commit a44b8a4013

View file

@ -758,6 +758,10 @@ impl<K, V, ALLOCATOR: ClonableAllocator> NodeStorage<K, V, ALLOCATOR> {
if let Some((k, v)) = node.key_value_mut() { if let Some((k, v)) = node.key_value_mut() {
if !f(k, v) { if !f(k, v) {
self.remove_from_location(i); 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; continue;
} }
} }