use debug_assert instead
This commit is contained in:
parent
fe413b9ed2
commit
5f1236d351
@ -32,10 +32,7 @@ impl<T> PosMap<T> {
|
|||||||
pub fn get(&self, row: usize, col: usize) -> &T {
|
pub fn get(&self, row: usize, col: usize) -> &T {
|
||||||
let index = row * BOARD_SIZE + col;
|
let index = row * BOARD_SIZE + col;
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
debug_assert!(index > BOARD_AREA + 1, "index out of range");
|
||||||
if index > BOARD_AREA + 1 {
|
|
||||||
panic!("index is out of range");
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe { self.0.get_unchecked(index) }
|
unsafe { self.0.get_unchecked(index) }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user