From 1972707f88b22406ae1b0fb27e88e86b21620e49 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 18 Feb 2025 15:08:35 -0500 Subject: [PATCH] clippy --- src/bitboard.rs | 6 ++++++ src/board.rs | 6 ++++++ src/future_moves.rs | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/bitboard.rs b/src/bitboard.rs index c2a1728..ee79c18 100644 --- a/src/bitboard.rs +++ b/src/bitboard.rs @@ -11,6 +11,12 @@ type BBBaseType = u64; #[derive(Copy, Clone, PartialEq, Eq)] pub struct BitBoard(BitArr!(for BOARD_AREA, in BBBaseType, Lsb0)); +impl Default for BitBoard { + fn default() -> Self { + Self::new() + } +} + impl BitBoard { pub const fn new() -> Self { Self(bitarr!(BBBaseType, Lsb0; 0; BOARD_AREA)) diff --git a/src/board.rs b/src/board.rs index 3e29d29..ec6504d 100644 --- a/src/board.rs +++ b/src/board.rs @@ -131,6 +131,12 @@ impl fmt::Debug for Board { } } +impl Default for Board { + fn default() -> Self { + Self::new() + } +} + impl Board { /// Create a new empty board pub const fn new() -> Self { diff --git a/src/future_moves.rs b/src/future_moves.rs index cd75901..8fa36e7 100644 --- a/src/future_moves.rs +++ b/src/future_moves.rs @@ -92,6 +92,10 @@ impl FutureMoves { self.arena.len() } + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Generate children for all children of `nodes` fn extend_layers(&mut self) { let mut next_nodes: Vec = (0..self.arena.len())