Skip to content

Commit 120ba6c

Browse files
committed
fix: move debug_assert check
1 parent df9093d commit 120ba6c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/dynamic_set.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ impl Set {
8787
}
8888

8989
pub(crate) fn remove(&self, ptr: *mut Entry) {
90-
let bucket_index = {
91-
let value: &Entry = unsafe { &*ptr };
92-
debug_assert!(value.ref_count.load(SeqCst) == 0);
93-
(value.hash & BUCKET_MASK) as usize
94-
};
90+
let value: &Entry = unsafe { &*ptr };
91+
let bucket_index = (value.hash & BUCKET_MASK) as usize;
9592

9693
let mut linked_list = self.buckets[bucket_index].lock();
94+
debug_assert!(value.ref_count.load(SeqCst) == 0);
9795
let mut current: &mut Option<Box<Entry>> = &mut linked_list;
9896

9997
while let Some(entry_ptr) = current.as_mut() {

0 commit comments

Comments
 (0)