From 534c022981c31f139bde33f541e0b1b1c032b774 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 13 Jul 2024 07:21:21 -0700 Subject: [PATCH] [core] Add #[must_use] to several methods in coordinates --- core/src/coordinates.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/coordinates.rs b/core/src/coordinates.rs index 4805a87..e650ad7 100644 --- a/core/src/coordinates.rs +++ b/core/src/coordinates.rs @@ -85,7 +85,6 @@ macro_rules! range_bound_struct { &self.0 } - #[must_use] $vis fn iter(&self) -> impl Iterator { (Self::FIRST.0..=Self::LAST.0).map(Self) } @@ -195,10 +194,12 @@ impl Rank { pub const PAWN_DOUBLE_PUSH_TARGET_RANKS: [Rank; 2] = [Rank::FOUR, Rank::FIVE]; + #[must_use] pub fn is_pawn_starting_rank(&self, color: Color) -> bool { self == &Self::PAWN_STARTING_RANKS[color as usize] } + #[must_use] pub fn is_pawn_double_push_target_rank(&self, color: Color) -> bool { self == &Self::PAWN_DOUBLE_PUSH_TARGET_RANKS[color as usize] } @@ -220,12 +221,14 @@ impl Square { /// # Safety /// /// This function does not do any bounds checking on the input. + #[must_use] pub unsafe fn from_index(x: u8) -> Square { debug_assert!((x as usize) < Self::NUM); Self::try_from(x).unwrap_unchecked() } #[inline] + #[must_use] pub fn from_file_rank(file: File, rank: Rank) -> Square { let file_int: u8 = file.into(); let rank_int: u8 = rank.into();