Skip to content

Commit 5fe3c0b

Browse files
authored
Merge pull request #658 from clarfonthey/yeet-insert-slot
refactor: Remove `InsertSlot`
2 parents 64aa7d5 + 613f533 commit 5fe3c0b

File tree

4 files changed

+98
-116
lines changed

4 files changed

+98
-116
lines changed

src/map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,27 +1840,27 @@ where
18401840
#[cfg_attr(feature = "inline-more", inline)]
18411841
pub fn insert(&mut self, k: K, v: V) -> Option<V> {
18421842
let hash = make_hash::<K, S>(&self.hash_builder, &k);
1843-
match self.find_or_find_insert_slot(hash, &k) {
1843+
match self.find_or_find_insert_index(hash, &k) {
18441844
Ok(bucket) => Some(mem::replace(unsafe { &mut bucket.as_mut().1 }, v)),
1845-
Err(slot) => {
1845+
Err(index) => {
18461846
unsafe {
1847-
self.table.insert_in_slot(hash, slot, (k, v));
1847+
self.table.insert_at_index(hash, index, (k, v));
18481848
}
18491849
None
18501850
}
18511851
}
18521852
}
18531853

18541854
#[cfg_attr(feature = "inline-more", inline)]
1855-
pub(crate) fn find_or_find_insert_slot<Q>(
1855+
pub(crate) fn find_or_find_insert_index<Q>(
18561856
&mut self,
18571857
hash: u64,
18581858
key: &Q,
1859-
) -> Result<Bucket<(K, V)>, crate::raw::InsertSlot>
1859+
) -> Result<Bucket<(K, V)>, usize>
18601860
where
18611861
Q: Equivalent<K> + ?Sized,
18621862
{
1863-
self.table.find_or_find_insert_slot(
1863+
self.table.find_or_find_insert_index(
18641864
hash,
18651865
equivalent_key(key),
18661866
make_hasher(&self.hash_builder),

0 commit comments

Comments
 (0)