1
0
Fork 0

fix file & rank parsing

This commit is contained in:
Paul-Nicolas Madelaine 2025-10-22 22:59:53 +02:00
parent a6a00fc819
commit c71bbc216f

View file

@ -116,8 +116,8 @@ impl File {
}
#[inline]
pub fn from_char(c: char) -> Option<Self> {
Self::from_ascii(c as u8)
pub fn from_char(file: char) -> Option<Self> {
u8::try_from(file).ok().and_then(Self::from_ascii)
}
#[inline]
@ -188,8 +188,8 @@ impl Rank {
}
#[inline]
pub fn from_char(c: char) -> Option<Self> {
Self::from_ascii(c as u8)
pub fn from_char(rank: char) -> Option<Self> {
u8::try_from(rank).ok().and_then(Self::from_ascii)
}
#[inline]