mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-02 14:03:12 +00:00
clippy changes
This commit is contained in:
parent
2544150594
commit
cc76ac0cb5
@ -115,7 +115,7 @@ impl TicTacToeApp<Initialized> {
|
||||
|
||||
TicTacToeApp {
|
||||
game_state: self.game_state,
|
||||
waku: waku,
|
||||
waku,
|
||||
game_topic: self.game_topic,
|
||||
tx: self.tx,
|
||||
player_role: self.player_role,
|
||||
@ -151,19 +151,19 @@ impl TicTacToeApp<Running> {
|
||||
if let Ok(mut game_state) = self.game_state.try_lock() {
|
||||
|
||||
if let Some(my_role) = self.player_role {
|
||||
if (*game_state).current_turn != my_role {
|
||||
if game_state.current_turn != my_role {
|
||||
return; // skip click if not my turn
|
||||
}
|
||||
}
|
||||
|
||||
if (*game_state).board[row][col].is_none() && (*game_state).moves_left > 0 {
|
||||
(*game_state).board[row][col] = Some((*game_state).current_turn);
|
||||
(*game_state).moves_left -= 1;
|
||||
if game_state.board[row][col].is_none() && game_state.moves_left > 0 {
|
||||
game_state.board[row][col] = Some(game_state.current_turn);
|
||||
game_state.moves_left -= 1;
|
||||
|
||||
if let Some(winner) = self.check_winner(&game_state) {
|
||||
(*game_state).current_turn = winner;
|
||||
game_state.current_turn = winner;
|
||||
} else {
|
||||
(*game_state).current_turn = match (*game_state).current_turn {
|
||||
game_state.current_turn = match game_state.current_turn {
|
||||
Player::X => Player::O,
|
||||
Player::O => Player::X,
|
||||
};
|
||||
@ -245,7 +245,7 @@ impl eframe::App for TicTacToeApp<Running> {
|
||||
if ui.button("Play as O").clicked() {
|
||||
self.player_role = Some(Player::O);
|
||||
if let Ok(mut game_state) = self.game_state.try_lock() {
|
||||
(*game_state).current_turn = Player::X; // player X should start
|
||||
game_state.current_turn = Player::X; // player X should start
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +76,8 @@ impl App<Initialized> {
|
||||
input: String::new(),
|
||||
input_mode: InputMode::Normal,
|
||||
messages: Arc::new(RwLock::new(Vec::new())),
|
||||
nick: nick,
|
||||
waku: waku,
|
||||
nick,
|
||||
waku,
|
||||
})
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ impl App<Initialized> {
|
||||
nick: self.nick,
|
||||
input_mode: self.input_mode,
|
||||
messages: self.messages,
|
||||
waku: waku,
|
||||
waku,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ impl App<Running> {
|
||||
})
|
||||
.collect();
|
||||
|
||||
if messages.len() > 0 {
|
||||
if !messages.is_empty() {
|
||||
*self.messages.write().unwrap() = messages;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user