From f0b6cb5f08189e6308c41a83f810c7773a135268 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 16 Jun 2025 08:58:22 -0700 Subject: [PATCH] [core] Do a little cleanup in core::coordinates Import std::fmt and remove some commented out code. --- core/src/coordinates.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/core/src/coordinates.rs b/core/src/coordinates.rs index aceec8c..99a252e 100644 --- a/core/src/coordinates.rs +++ b/core/src/coordinates.rs @@ -5,7 +5,7 @@ mod wings; pub use wings::Wing; use crate::Color; -use std::fmt; +use std::{fmt, str::FromStr}; use thiserror::Error; macro_rules! try_from_integer { @@ -254,19 +254,6 @@ to_square_enum!( } ); -// impl TryFrom for EnPassantTargetSquare { -// type Error = (); - -// fn try_from(value: Square) -> Result { -// let square = Self::ALL[value as usize]; -// if square as usize == value as usize { -// Ok(square) -// } else { -// Err(()) -// } -// } -// } - impl Square { /// # Safety /// @@ -391,7 +378,7 @@ impl TryFrom<&str> for Square { } } -impl std::str::FromStr for Square { +impl FromStr for Square { type Err = ParseSquareError; fn from_str(s: &str) -> Result { @@ -415,7 +402,7 @@ impl std::str::FromStr for Square { #[error("invalid rank")] pub struct ParseRankError; -impl std::str::FromStr for Rank { +impl FromStr for Rank { type Err = ParseRankError; fn from_str(s: &str) -> Result { @@ -438,7 +425,7 @@ impl std::str::FromStr for Rank { #[error("invalid file")] pub struct ParseFileError; -impl std::str::FromStr for File { +impl FromStr for File { type Err = ParseFileError; fn from_str(s: &str) -> Result {