diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 2fb4834..1ce69a2 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -357,17 +357,15 @@ impl FutureMoves { } fn get_board_from_idx(&self, idx: usize) -> Option { - if let Some(hist) = self.move_history(idx) { + self.move_history(idx).map(|hist| { let mut board = self.board; for (m, c) in hist { if let Some(m) = m { board.place(m, c).expect("move would not propegate"); } } - Some(board) - } else { - None - } + board + }) } /// Return the best move which is a child of `self.current_root`