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);