From 6a00560a8a7f7d026d2375b393d7d9624b63d3a2 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 25 Feb 2025 10:15:26 -0500 Subject: [PATCH] simplify update_from_board checking of current_root --- src/logic/future_moves.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 07a3cd9..f368da7 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -250,10 +250,9 @@ impl FutureMoves { .arena .iter() .enumerate() - .find(|(_, m)| { - &m.board == board && (m.parent == self.current_root) && self.current_root.is_some() - }) - .map(|(idx, _)| idx); + .find(|(_, m)| &m.board == board && (m.parent == self.current_root)) + .map(|(idx, _)| idx) + .filter(|_| self.current_root.is_some()); if let Some(curr_board_idx) = curr_board { self.set_root_idx_raw(curr_board_idx);