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

View file

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

View file

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