remove unnecessary Result function return value

This commit is contained in:
Baptiste Fouques 2023-02-22 11:19:30 +01:00
parent 26a15985a8
commit da6060cf37
2 changed files with 5 additions and 8 deletions

View File

@ -346,9 +346,9 @@ impl<Fi: Read, Fo: Write> UciEngine<Fi, Fo> {
}
}
pub fn go(&mut self) -> Result<(), &'static str> {
pub fn go(&mut self) {
match self.player[self.side_to_move().to_index()] {
Player::Human { .. } => Err("Not a machine to play for current color."),
Player::Human { .. } => warn!("Not a machine to play for current color."),
Player::Engine { elo } => {
if self.is_uciok() {
if let Some(elo) = elo {
@ -367,17 +367,14 @@ impl<Fi: Read, Fo: Write> UciEngine<Fi, Fo> {
btime,
bincr,
});
Ok(())
} else {
Err("UCI engine not ready")
warn!("UCI engine not ready")
}
}
}
}
pub fn stop(&mut self) -> Result<(), &'static str> {
pub fn stop(&mut self) {
self.push(GuiCommand::Stop);
Ok(())
}
}

View File

@ -142,7 +142,7 @@ pub fn parse(message: &mut str) -> Result<EngineCommand, &'static str> {
Some("bestmove") => match message_iter.collect::<Vec<&str>>().as_slice() {
[] => Err("Empty bestmove command"),
[chessmove] => Ok(EngineCommand::BestMove {
best_move: ChessMove::from_str(chessmove).expect("chessmove is invalid"),
best_move: ChessMove::from_str(chessmove).expect(&format!("chessmove {:?} is invalid", chessmove)),
ponder: None,
}),
[_, "ponder"] => Err("Empty ponder in bestmove command"),