@@ -1689,18 +1689,20 @@ impl RawTableInner {
16891689 insert_slot = self . find_insert_slot_in_group ( & group, & probe_seq) ;
16901690 }
16911691
1692- // Only stop the search if the group contains at least one empty element.
1693- // Otherwise, the element that we are looking for might be in a following group.
1694- if likely ( group. match_empty ( ) . any_bit_set ( ) ) {
1695- // We must have found a insert slot by now, since the current group contains at
1696- // least one. For tables smaller than the group width, there will still be an
1697- // empty element in the current (and only) group due to the load factor.
1698- unsafe {
1699- // SAFETY:
1700- // * Caller of this function ensures that the control bytes are properly initialized.
1701- //
1702- // * We use this function with the slot / index found by `self.find_insert_slot_in_group`
1703- return Err ( self . fix_insert_slot ( insert_slot. unwrap_unchecked ( ) ) ) ;
1692+ if let Some ( insert_slot) = insert_slot {
1693+ // Only stop the search if the group contains at least one empty element.
1694+ // Otherwise, the element that we are looking for might be in a following group.
1695+ if likely ( group. match_empty ( ) . any_bit_set ( ) ) {
1696+ // We must have found a insert slot by now, since the current group contains at
1697+ // least one. For tables smaller than the group width, there will still be an
1698+ // empty element in the current (and only) group due to the load factor.
1699+ unsafe {
1700+ // SAFETY:
1701+ // * Caller of this function ensures that the control bytes are properly initialized.
1702+ //
1703+ // * We use this function with the slot / index found by `self.find_insert_slot_in_group`
1704+ return Err ( self . fix_insert_slot ( insert_slot) ) ;
1705+ }
17041706 }
17051707 }
17061708
0 commit comments