[core] Do a little cleanup in core::coordinates
Import std::fmt and remove some commented out code.
This commit is contained in:
parent
3951af76cb
commit
f0b6cb5f08
1 changed files with 4 additions and 17 deletions
|
@ -5,7 +5,7 @@ mod wings;
|
||||||
pub use wings::Wing;
|
pub use wings::Wing;
|
||||||
|
|
||||||
use crate::Color;
|
use crate::Color;
|
||||||
use std::fmt;
|
use std::{fmt, str::FromStr};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
macro_rules! try_from_integer {
|
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 {
|
impl Square {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
|
@ -391,7 +378,7 @@ impl TryFrom<&str> for Square {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::str::FromStr for Square {
|
impl FromStr for Square {
|
||||||
type Err = ParseSquareError;
|
type Err = ParseSquareError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
@ -415,7 +402,7 @@ impl std::str::FromStr for Square {
|
||||||
#[error("invalid rank")]
|
#[error("invalid rank")]
|
||||||
pub struct ParseRankError;
|
pub struct ParseRankError;
|
||||||
|
|
||||||
impl std::str::FromStr for Rank {
|
impl FromStr for Rank {
|
||||||
type Err = ParseRankError;
|
type Err = ParseRankError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
@ -438,7 +425,7 @@ impl std::str::FromStr for Rank {
|
||||||
#[error("invalid file")]
|
#[error("invalid file")]
|
||||||
pub struct ParseFileError;
|
pub struct ParseFileError;
|
||||||
|
|
||||||
impl std::str::FromStr for File {
|
impl FromStr for File {
|
||||||
type Err = ParseFileError;
|
type Err = ParseFileError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue