diff --git a/src/board.rs b/src/board.rs index d84ba43..186693b 100644 --- a/src/board.rs +++ b/src/board.rs @@ -116,8 +116,8 @@ impl File { } #[inline] - pub fn from_char(c: char) -> Option { - Self::from_ascii(c as u8) + pub fn from_char(file: char) -> Option { + 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::from_ascii(c as u8) + pub fn from_char(rank: char) -> Option { + u8::try_from(rank).ok().and_then(Self::from_ascii) } #[inline]