diff --git a/src/repr/board.rs b/src/repr/board.rs index d2cd99b..a5358b0 100644 --- a/src/repr/board.rs +++ b/src/repr/board.rs @@ -79,10 +79,7 @@ impl fmt::Display for Board { write!( f, "{}|", - self.get((i, j).into()) - .as_ref() - .map(Piece::symbol) - .unwrap_or(' ') + self.get((i, j).into()).map(Piece::symbol).unwrap_or(' ') )?; } writeln!(f)?; diff --git a/src/repr/piece.rs b/src/repr/piece.rs index 5c8bc20..ffcbca9 100644 --- a/src/repr/piece.rs +++ b/src/repr/piece.rs @@ -7,21 +7,21 @@ pub enum Piece { } impl Piece { - pub const fn flip(&self) -> Self { + pub const fn flip(self) -> Self { match self { Piece::Black => Piece::White, Piece::White => Piece::Black, } } - pub const fn symbol(&self) -> char { + pub const fn symbol(self) -> char { match self { Piece::White => '■', Piece::Black => '□', } } - pub const fn text(&self) -> &'static str { + pub const fn text(self) -> &'static str { match self { Piece::Black => "Black", Piece::White => "White",