[bitboard] Remove leading underscore from leading_zeros and trailing_zeros methods

This is a clippy suggestion.
This commit is contained in:
Eryn Wells 2025-05-16 07:44:37 -07:00
parent 184e81a7c8
commit e5a5367864

View file

@ -258,7 +258,7 @@ impl BitBoard {
/// the board is empty, returns `None`. /// the board is empty, returns `None`.
#[must_use] #[must_use]
pub fn first_occupied_square_leading(self) -> Option<Square> { pub fn first_occupied_square_leading(self) -> Option<Square> {
let leading_zeros = self._leading_zeros(); let leading_zeros = self.leading_zeros();
if leading_zeros < SQUARES_NUM { if leading_zeros < SQUARES_NUM {
unsafe { unsafe {
Some(Square::from_index_unchecked( Some(Square::from_index_unchecked(
@ -275,7 +275,7 @@ impl BitBoard {
/// If the board is empty, returns `None`. /// If the board is empty, returns `None`.
#[must_use] #[must_use]
pub fn first_occupied_square_trailing(self) -> Option<Square> { pub fn first_occupied_square_trailing(self) -> Option<Square> {
let trailing_zeros = self._trailing_zeros(); let trailing_zeros = self.trailing_zeros();
if trailing_zeros < SQUARES_NUM { if trailing_zeros < SQUARES_NUM {
unsafe { Some(Square::from_index_unchecked(trailing_zeros)) } unsafe { Some(Square::from_index_unchecked(trailing_zeros)) }
@ -288,13 +288,13 @@ impl BitBoard {
impl BitBoard { impl BitBoard {
#[must_use] #[must_use]
#[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_possible_truncation)]
fn _leading_zeros(self) -> u8 { fn leading_zeros(self) -> u8 {
self.0.leading_zeros() as u8 self.0.leading_zeros() as u8
} }
#[must_use] #[must_use]
#[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_possible_truncation)]
fn _trailing_zeros(self) -> u8 { fn trailing_zeros(self) -> u8 {
self.0.trailing_zeros() as u8 self.0.trailing_zeros() as u8
} }
} }
@ -357,7 +357,7 @@ impl TryFrom<BitBoard> for Square {
return Err(TryFromBitBoardError::NotSingleSquare); return Err(TryFromBitBoardError::NotSingleSquare);
} }
unsafe { Ok(Square::from_index_unchecked(value._trailing_zeros())) } unsafe { Ok(Square::from_index_unchecked(value.trailing_zeros())) }
} }
} }