Consistently use 'Self' type in 'impl' blocks

This commit is contained in:
Bruno BELANYI 2022-07-20 19:18:46 +02:00
parent b68dd132e8
commit 407f85c19b
3 changed files with 21 additions and 21 deletions

View file

@ -15,19 +15,19 @@ pub enum File {
} }
impl File { impl File {
const ALL: [File; 8] = [ const ALL: [Self; 8] = [
File::A, Self::A,
File::B, Self::B,
File::C, Self::C,
File::D, Self::D,
File::E, Self::E,
File::F, Self::F,
File::G, Self::G,
File::H, Self::H,
]; ];
/// Iterate over all files in order. /// Iterate over all files in order.
pub fn iter() -> impl Iterator<Item = File> { pub fn iter() -> impl Iterator<Item = Self> {
Self::ALL.iter().cloned() Self::ALL.iter().cloned()
} }

View file

@ -15,19 +15,19 @@ pub enum Rank {
} }
impl Rank { impl Rank {
const ALL: [Rank; 8] = [ const ALL: [Self; 8] = [
Rank::First, Self::First,
Rank::Second, Self::Second,
Rank::Third, Self::Third,
Rank::Fourth, Self::Fourth,
Rank::Fifth, Self::Fifth,
Rank::Sixth, Self::Sixth,
Rank::Seventh, Self::Seventh,
Rank::Eighth, Self::Eighth,
]; ];
/// Iterate over all ranks in order. /// Iterate over all ranks in order.
pub fn iter() -> impl Iterator<Item = Rank> { pub fn iter() -> impl Iterator<Item = Self> {
Self::ALL.iter().cloned() Self::ALL.iter().cloned()
} }

View file

@ -43,7 +43,7 @@ impl Square {
} }
/// Iterate over all squares in order. /// Iterate over all squares in order.
pub fn iter() -> impl Iterator<Item = Square> { pub fn iter() -> impl Iterator<Item = Self> {
Self::ALL.iter().cloned() Self::ALL.iter().cloned()
} }