[core] Use the matches! macro to calculate the value of Shape::is_promotable
I learned about this macro a little while ago and it's better than writing out a match block by hand, and also doesn't require static or const data, like the previous implementation did.
This commit is contained in:
parent
a91bb8c983
commit
abaf277fb4
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ impl Shape {
|
|||
|
||||
#[must_use]
|
||||
pub fn is_promotable(&self) -> bool {
|
||||
Self::PROMOTABLE_SHAPES.contains(self)
|
||||
matches!(self, Self::Knight | Self::Bishop | Self::Rook | Self::Queen)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue