Skip to content

Commit

Permalink
Update uci_connection.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerros committed Sep 23, 2024
1 parent d9e8c04 commit 161e797
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/uci_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl EngineConnection {
}

/// Equivalent to the [`go`] function, but doesn't store a vec of info messages, instead just returning the last one.
pub async fn go_only_last_info(&mut self, message: GoMessage) -> io::Result<(InfoMessage, BestMoveMessage)> {
pub async fn go_only_last_info(&mut self, message: GoMessage) -> io::Result<(Option<InfoMessage>, BestMoveMessage)> {
self.send_message(&GuiMessage::Go(message)).await?;

let mut last_info_message = None;
Expand All @@ -244,10 +244,10 @@ impl EngineConnection {
};

match engine_to_gui_message {
EngineMessage::Info(info) => last_info_message = Some(info),
EngineMessage::Info(info) => last_info_message = Some(*info),
// CLIPPY: Engines always return at least one info message.
#[allow(clippy::unwrap_used)]
EngineMessage::BestMove(best_move) => return Ok((*last_info_message.unwrap(), best_move)),
EngineMessage::BestMove(best_move) => return Ok((last_info_message, best_move)),
_ => (),
}
}
Expand Down

0 comments on commit 161e797

Please sign in to comment.