use debug_assert instead

This commit is contained in:
Simon Gardling 2025-02-19 22:02:38 -05:00
parent fe413b9ed2
commit 5f1236d351
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -32,10 +32,7 @@ impl<T> PosMap<T> {
pub fn get(&self, row: usize, col: usize) -> &T {
let index = row * BOARD_SIZE + col;
#[cfg(debug_assertions)]
if index > BOARD_AREA + 1 {
panic!("index is out of range");
}
debug_assert!(index > BOARD_AREA + 1, "index out of range");
unsafe { self.0.get_unchecked(index) }
}