diff --git a/server/src/main.rs b/server/src/main.rs index 187308e..bd5a748 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -124,15 +124,12 @@ async fn incoming_message_handler( let game = room.game.as_mut().unwrap(); let result = match r#move { GameMove::Pass => game.pass(&player), - GameMove::Exchange { tiles } => { - game.exchange(&player, tiles) - } + GameMove::Exchange { tiles } => game.exchange(&player, tiles), GameMove::Play { played_tiles, commit_move, } => { - let result = - game.play(&player, played_tiles, commit_move); + let result = game.play(&player, played_tiles, commit_move); if result.is_ok() & !commit_move { let event = ServerToClientMessage::GameEvent { event: GameEvent::TurnAction { @@ -308,7 +305,13 @@ async fn room( let mut room = d.write().await; // check if player is already in the room. If they are, don't allow the new connection - if room.party_info.players.iter().map(|f| f.to_lowercase()).contains(&player.to_lowercase()) { + if room + .party_info + .players + .iter() + .map(|f| f.to_lowercase()) + .contains(&player.to_lowercase()) + { return reject_websocket_with_reason( ws, CloseCode::Protocol, @@ -317,12 +320,7 @@ async fn room( } if let Some(game) = &room.game { - if game - .0 - .player_states - .get_player_state(&player) - .is_none() - { + if game.0.player_states.get_player_state(&player).is_none() { // Game is in progress and our new player isn't a member return reject_websocket_with_reason( ws,