From 9ab583a57ea4290938dc349c67dbba9be4e8b990 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 20 Mar 2025 02:13:02 -0400 Subject: [PATCH] Board: formatting code improvement --- src/repr/board.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/repr/board.rs b/src/repr/board.rs index 6d1cc21..9cc88b2 100644 --- a/src/repr/board.rs +++ b/src/repr/board.rs @@ -120,16 +120,12 @@ impl fmt::Display for Board { } // put a line at the bottom of the board too - writeln!(f, " {}", HORIZ_SEP_LINE)?; + writeln!(f, "{}{}", SPACE_PADDING, HORIZ_SEP_LINE)?; // Print the current score - write!( - f, - "{}", - [Piece::White, Piece::Black] - .map(|p| format!("{} Score: {}\n", p.text(), self.count(p))) - .concat() - )?; + for p in [Piece::White, Piece::Black] { + writeln!(f, "{} Score: {}", p.text(), self.count(p))?; + } Ok(()) }