[core] Add #[must_use] to several methods in coordinates
This commit is contained in:
parent
7e45e49502
commit
534c022981
1 changed files with 4 additions and 1 deletions
|
@ -85,7 +85,6 @@ macro_rules! range_bound_struct {
|
|||
&self.0
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
$vis fn iter(&self) -> impl Iterator<Item = Self> {
|
||||
(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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue