Skip to content

Commit

Permalink
Get rid of unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hui committed Oct 10, 2023
1 parent dc4cebe commit de422ad
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ impl Arena {
ref_count: RefCell::new(1),
});

unsafe {
let base_prio = priorities.get_unchecked(base);
base_prio.set_next(first);
base_prio.set_prev(first);
}
let base_prio = priorities.get(base).expect("base should have just been inserted");
base_prio.set_next(first);
base_prio.set_prev(first);

(
Self {
Expand Down Expand Up @@ -465,8 +463,8 @@ mod tests {
v.push(v[v.len() - 1].insert());
}

for i in 0..v.len() - 1{
assert!(v[i] < v[i+1])
for i in 0..v.len() - 1 {
assert!(v[i] < v[i + 1])
}
}
}

0 comments on commit de422ad

Please sign in to comment.