From a91bb8c9838ca9eabe4ec407a041ebfb52e441a9 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 20 Jun 2025 14:24:16 -0700 Subject: [PATCH] [board] Remove the unused Mailbox::new method Just use Mailbox::default(). --- board/src/piece_sets/mailbox.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/board/src/piece_sets/mailbox.rs b/board/src/piece_sets/mailbox.rs index 5d73561..74b32bc 100644 --- a/board/src/piece_sets/mailbox.rs +++ b/board/src/piece_sets/mailbox.rs @@ -7,10 +7,6 @@ use std::iter::FromIterator; pub(crate) struct Mailbox([Option; Square::NUM]); impl Mailbox { - pub fn new() -> Self { - Self::default() - } - pub fn get(&self, square: Square) -> Option { self.0[square as usize] } @@ -46,7 +42,7 @@ impl From<[Option; Square::NUM]> for Mailbox { impl FromIterator<(Square, Piece)> for Mailbox { fn from_iter>(iter: T) -> Self { iter.into_iter() - .fold(Self::new(), |mut mailbox, (square, piece)| { + .fold(Self::default(), |mut mailbox, (square, piece)| { mailbox.set(piece, square); mailbox }) @@ -61,7 +57,7 @@ mod tests { #[test] fn iter_returns_all_pieces() { - let mut mailbox = Mailbox::new(); + let mut mailbox = Mailbox::default(); mailbox.set(piece!(White Queen), Square::C3); mailbox.set(piece!(White Rook), Square::H8); mailbox.set(piece!(Black Bishop), Square::E4);