From e10bffbca84218e9a3b78ca58ad177b20e3ad466 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Sat, 14 Aug 2021 13:40:43 -0700 Subject: [PATCH] Fix bug in refactored BitVec (found by @Amanieu). --- src/bitvec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitvec.rs b/src/bitvec.rs index 907756f..b9592a1 100644 --- a/src/bitvec.rs +++ b/src/bitvec.rs @@ -89,7 +89,7 @@ impl AdaptiveMap { // implementation is not able to see that the `self` // mutable borrow on return is only on the // early-return path. - let small_mode_idx = keys.iter().position(|k| *k == key); + let small_mode_idx = keys.iter().take(len as usize).position(|k| *k == key); let needs_expand = small_mode_idx.is_none() && len == SMALL_ELEMS as u32; (needs_expand, small_mode_idx) }