From 693b5c1f7c5eebd21e4751ef027bfdb816127a5d Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 22 Apr 2025 15:52:17 -0400 Subject: [PATCH] simplify FutureMoves::move_history --- src/logic/future_moves.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 1ce69a2..d76b640 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -331,7 +331,7 @@ impl FutureMoves { } fn move_history(&self, idx: usize) -> Option> { - if let Some(root) = self.current_root { + self.current_root.and_then(|root| { let mut hist = Vec::new(); let mut current = Some(idx); @@ -351,9 +351,7 @@ impl FutureMoves { } Some(hist) - } else { - None - } + }) } fn get_board_from_idx(&self, idx: usize) -> Option {