Skip to content

Commit

Permalink
Fix the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Oct 18, 2023
1 parent 5f6f988 commit d4c693d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/zerovec/src/map2d/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ where
let (key0_index, range) = self.get_or_insert_range_for_key0(key0);
debug_assert!(range.start <= range.end); // '<=' because we may have inserted a new key0
debug_assert!(range.end <= self.keys1.zvl_len());
let range_start = range.start;
#[allow(clippy::unwrap_used)] // by debug_assert! invariants
let index = range.start
let index = range_start
+ match self.keys1.zvl_binary_search_in_range(key1, range).unwrap() {
Ok(index) => return Some(self.values.zvl_replace(index, value)),
Ok(index) => return Some(self.values.zvl_replace(range_start + index, value)),
Err(index) => index,
};
self.keys1.zvl_insert(index, key1);
Expand Down

0 comments on commit d4c693d

Please sign in to comment.