[bitboard,core,position] Address a bunch of clippy warnings

This commit is contained in:
Eryn Wells 2024-03-14 17:00:46 -07:00
parent d0abbd8f93
commit 27a36565f3
8 changed files with 63 additions and 32 deletions

View file

@ -1,10 +1,9 @@
// Eryn Wells <eryn@erynwells.me>
use crate::sight::SliderRayToSquareExt;
use chessfriend_bitboard::BitBoard;
use chessfriend_core::Shape;
use crate::sight::SliderRayToSquareExt;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CheckingPieces {
bitboards: [BitBoard; 5],
@ -23,12 +22,12 @@ impl CheckingPieces {
}
}
/// The number of checking pieces.
pub fn count(&self) -> u32 {
self.bitboards.iter().map(BitBoard::population_count).sum()
}
/// A BitBoard representing the set of pieces that must be captured to
/// resolve check.
/// A BitBoard representing the set of pieces that must be captured to resolve check.
pub fn capture_mask(&self) -> BitBoard {
if self.count() == 0 {
BitBoard::FULL
@ -39,8 +38,8 @@ impl CheckingPieces {
}
}
/// A BitBoard representing the set of squares to which a player can move a
/// piece to block a checking piece.
/// A BitBoard representing the set of squares to which a player can move a piece to block a
/// checking piece.
pub fn push_mask(&self, king: &BitBoard) -> BitBoard {
let target = king.first_occupied_square().unwrap();