From 024a41fa18418b3a6459f4d7e08dbbe5e2b3e05e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 29 Jul 2022 19:26:05 +0200 Subject: [PATCH] Use unchecked conversion in 'BitboardIterator --- src/board/bitboard/iterator.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/board/bitboard/iterator.rs b/src/board/bitboard/iterator.rs index fcd644c..ea6d489 100644 --- a/src/board/bitboard/iterator.rs +++ b/src/board/bitboard/iterator.rs @@ -11,7 +11,8 @@ impl Iterator for BitboardIterator { } else { let lsb = self.0.trailing_zeros() as usize; self.0 ^= 1 << lsb; - Some(crate::board::Square::from_index(lsb)) + // SAFETY: we know the value is in-bounds + Some(unsafe { crate::board::Square::from_index_unchecked(lsb) }) } }