[core] Do a little cleanup in core::coordinates

Import std::fmt and remove some commented out code.
This commit is contained in:
Eryn Wells 2025-06-16 08:58:22 -07:00
parent 3951af76cb
commit f0b6cb5f08

View file

@ -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<Square> for EnPassantTargetSquare {
// type Error = ();
// fn try_from(value: Square) -> Result<Self, Self::Error> {
// 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<Self, Self::Err> {
@ -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<Self, Self::Err> {
@ -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<Self, Self::Err> {