mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Use a HashSet in free-list check.
This commit is contained in:
parent
e67ea42c3f
commit
fc6bed28ff
1 changed files with 4 additions and 3 deletions
|
@ -468,18 +468,19 @@ impl StrongRuleNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
|
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
|
||||||
assert!(cfg!(debug_assertions));
|
assert!(cfg!(debug_assertions), "This is an expensive check!");
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
let me = &*self.ptr;
|
let me = &*self.ptr;
|
||||||
assert!(me.is_root());
|
assert!(me.is_root());
|
||||||
|
|
||||||
let mut current = self.ptr;
|
let mut current = self.ptr;
|
||||||
let mut seen = vec![];
|
let mut seen = HashSet::new();
|
||||||
while current != FREE_LIST_SENTINEL {
|
while current != FREE_LIST_SENTINEL {
|
||||||
let next = (*current).next_free.load(Ordering::SeqCst);
|
let next = (*current).next_free.load(Ordering::SeqCst);
|
||||||
assert!(!next.is_null());
|
assert!(!next.is_null());
|
||||||
assert!(!seen.contains(&next));
|
assert!(!seen.contains(&next));
|
||||||
seen.push(next);
|
seen.insert(next);
|
||||||
|
|
||||||
current = next;
|
current = next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue