@@ -1718,18 +1718,20 @@ impl RawTableInner {
1718
1718
insert_slot = self . find_insert_slot_in_group ( & group, & probe_seq) ;
1719
1719
}
1720
1720
1721
- // Only stop the search if the group contains at least one empty element.
1722
- // Otherwise, the element that we are looking for might be in a following group.
1723
- if likely ( group. match_empty ( ) . any_bit_set ( ) ) {
1724
- // We must have found a insert slot by now, since the current group contains at
1725
- // least one. For tables smaller than the group width, there will still be an
1726
- // empty element in the current (and only) group due to the load factor.
1727
- unsafe {
1728
- // SAFETY:
1729
- // * Caller of this function ensures that the control bytes are properly initialized.
1730
- //
1731
- // * We use this function with the slot / index found by `self.find_insert_slot_in_group`
1732
- return Err ( self . fix_insert_slot ( insert_slot. unwrap_unchecked ( ) ) ) ;
1721
+ if let Some ( insert_slot) = insert_slot {
1722
+ // Only stop the search if the group contains at least one empty element.
1723
+ // Otherwise, the element that we are looking for might be in a following group.
1724
+ if likely ( group. match_empty ( ) . any_bit_set ( ) ) {
1725
+ // We must have found a insert slot by now, since the current group contains at
1726
+ // least one. For tables smaller than the group width, there will still be an
1727
+ // empty element in the current (and only) group due to the load factor.
1728
+ unsafe {
1729
+ // SAFETY:
1730
+ // * Caller of this function ensures that the control bytes are properly initialized.
1731
+ //
1732
+ // * We use this function with the slot / index found by `self.find_insert_slot_in_group`
1733
+ return Err ( self . fix_insert_slot ( insert_slot) ) ;
1734
+ }
1733
1735
}
1734
1736
}
1735
1737
0 commit comments