From 5dce65c57023bb7d17b81724caf80518a599fd79 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 6 Apr 2024 11:17:45 +0100 Subject: [PATCH] Use lower-case in error messages --- src/board/chess_board/error.rs | 24 ++++++++++++------------ src/fen.rs | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/board/chess_board/error.rs b/src/board/chess_board/error.rs index 5af3b25..b1ed769 100644 --- a/src/board/chess_board/error.rs +++ b/src/board/chess_board/error.rs @@ -30,24 +30,24 @@ pub enum ValidationError { impl std::fmt::Display for ValidationError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let error_msg = match self { - Self::TooManyPieces => "Too many pieces", - Self::MissingKing => "Missing king", - Self::InvalidPawnPosition => "Pawns on the first/last rank", + Self::TooManyPieces => "too many pieces", + Self::MissingKing => "missing king", + Self::InvalidPawnPosition => "pawns on the first/last rank", Self::InvalidCastlingRights => { - "Castling rights do not match up with the state of the board" + "castling rights do not match up with the state of the board" } Self::InvalidEnPassant => { - "En-passant target square is not empty, behind an opponent's pawn, on the correct rank" + "en-passant target square is not empty, behind an opponent's pawn, on the correct rank" } - Self::NeighbouringKings => "The two kings are next to each other", - Self::OpponentInCheck => "The opponent is currently in check", - Self::OverlappingPieces => "The piece-specific boards are overlapping", - Self::OverlappingColors => "The color-specific boards are overlapping", + Self::NeighbouringKings => "the two kings are next to each other", + Self::OpponentInCheck => "the opponent is currently in check", + Self::OverlappingPieces => "the piece-specific boards are overlapping", + Self::OverlappingColors => "the color-specific boards are overlapping", Self::ErroneousCombinedOccupancy => { - "The pre-computed combined occupancy boards does not match the other boards" + "the pre-computed combined occupancy boards does not match the other boards" } - Self::HalfMoveClockTooHigh => "Half-move clock is higher than total number of plies", - Self::IncoherentPlieCount => "The total plie count does not match the current player", + Self::HalfMoveClockTooHigh => "half-move clock is higher than total number of plies", + Self::IncoherentPlieCount => "the total plie count does not match the current player", }; write!(f, "{}", error_msg) } diff --git a/src/fen.rs b/src/fen.rs index df4005d..4c05879 100644 --- a/src/fen.rs +++ b/src/fen.rs @@ -21,8 +21,8 @@ pub enum FenError { impl std::fmt::Display for FenError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::InvalidFen => write!(f, "Invalid FEN input"), - Self::InvalidPosition(err) => write!(f, "Invalid chess position: {}", err), + Self::InvalidFen => write!(f, "invalid FEN input"), + Self::InvalidPosition(err) => write!(f, "invalid chess position: {}", err), } } }