Skip to content

Commit

Permalink
remove premature optimized unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jan 12, 2022
1 parent 29f688a commit 1995dbc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions polars/polars-utils/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ impl<T> Arena<T> {

#[inline]
pub fn get(&self, idx: Node) -> &T {
debug_assert!(idx.0 < self.items.len());
unsafe { self.items.get_unchecked(idx.0) }
self.items.get(idx.0).unwrap()
}

#[inline]
pub fn get_mut(&mut self, idx: Node) -> &mut T {
debug_assert!(idx.0 < self.items.len());
unsafe { self.items.get_unchecked_mut(idx.0) }
self.items.get_mut(idx.0).unwrap()
}

#[inline]
Expand Down

0 comments on commit 1995dbc

Please sign in to comment.