diff --git a/src/fen.rs b/src/fen.rs index 6c37ca9..9166be2 100644 --- a/src/fen.rs +++ b/src/fen.rs @@ -77,9 +77,9 @@ fn append_castling( for rook in (castling_rights & color.backrank()).into_iter().rev() { f.append_ascii( - if Some(rook) == candidates.first() && king.map_or(false, |k| rook < k) { + if Some(rook) == candidates.first() && king.is_some_and(|k| rook < k) { color.fold_wb('Q', 'q') - } else if Some(rook) == candidates.last() && king.map_or(false, |k| k < rook) { + } else if Some(rook) == candidates.last() && king.is_some_and(|k| k < rook) { color.fold_wb('K', 'k') } else { let file = rook.file(); diff --git a/src/position.rs b/src/position.rs index 096c244..b75ccbf 100644 --- a/src/position.rs +++ b/src/position.rs @@ -393,7 +393,7 @@ pub trait Position { /// Generates legal castling moves. fn castling_moves(&self, side: CastlingSide) -> MoveList { let mut moves = self.legal_moves(); - moves.retain(|m| m.castling_side().map_or(false, |s| side == s)); + moves.retain(|m| m.castling_side().is_some_and(|s| side == s)); moves } diff --git a/src/san.rs b/src/san.rs index 5aea388..d2163e0 100644 --- a/src/san.rs +++ b/src/san.rs @@ -449,7 +449,7 @@ impl San { } _ => false, }, - San::Castle(side) => m.castling_side().map_or(false, |s| side == s), + San::Castle(side) => m.castling_side().is_some_and(|s| side == s), San::Put { role, to } => match *m { Move::Put { role: r, to: t } => r == role && to == t, _ => false,