[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:
Eryn Wells 2025-06-20 14:25:10 -07:00
parent a91bb8c983
commit abaf277fb4

View file

@ -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]