From c71bbc216f5790b5cf57a7ce753144f3ea98fc92 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Wed, 22 Oct 2025 22:59:53 +0200 Subject: [PATCH] fix file & rank parsing --- src/board.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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]