Skip to content

Commit

Permalink
Cleanup expect function call
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Jan 19, 2019
1 parent e15ffe0 commit 323830f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ impl<T> Index<usize> for BoundedSlice<T> {
type Output = T;
fn index(&self, index: usize) -> &T {
self.get(index)
.expect(&format!("index: {} was out of bounds.", index))
.unwrap_or_else(|| panic!("index: {} was out of bounds.", index))
}
}

impl<T> IndexMut<usize> for BoundedSlice<T> {
fn index_mut(&mut self, index: usize) -> &mut T {
self.get_mut(index)
.expect(&format!("index: {} was out of bounds.", index))
.unwrap_or_else(|| panic!("index: {} was out of bounds.", index))
}
}

Expand Down

0 comments on commit 323830f

Please sign in to comment.