chore: Ran cargo fmt

This commit is contained in:
Joel Therrien 2024-12-28 22:35:59 -08:00
parent 710499b664
commit 3e187b57fb

View file

@ -124,15 +124,12 @@ async fn incoming_message_handler<E: std::fmt::Display>(
let game = room.game.as_mut().unwrap(); let game = room.game.as_mut().unwrap();
let result = match r#move { let result = match r#move {
GameMove::Pass => game.pass(&player), GameMove::Pass => game.pass(&player),
GameMove::Exchange { tiles } => { GameMove::Exchange { tiles } => game.exchange(&player, tiles),
game.exchange(&player, tiles)
}
GameMove::Play { GameMove::Play {
played_tiles, played_tiles,
commit_move, commit_move,
} => { } => {
let result = let result = game.play(&player, played_tiles, commit_move);
game.play(&player, played_tiles, commit_move);
if result.is_ok() & !commit_move { if result.is_ok() & !commit_move {
let event = ServerToClientMessage::GameEvent { let event = ServerToClientMessage::GameEvent {
event: GameEvent::TurnAction { event: GameEvent::TurnAction {
@ -308,7 +305,13 @@ async fn room(
let mut room = d.write().await; let mut room = d.write().await;
// check if player is already in the room. If they are, don't allow the new connection // 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( return reject_websocket_with_reason(
ws, ws,
CloseCode::Protocol, CloseCode::Protocol,
@ -317,12 +320,7 @@ async fn room(
} }
if let Some(game) = &room.game { if let Some(game) = &room.game {
if game if game.0.player_states.get_player_state(&player).is_none() {
.0
.player_states
.get_player_state(&player)
.is_none()
{
// Game is in progress and our new player isn't a member // Game is in progress and our new player isn't a member
return reject_websocket_with_reason( return reject_websocket_with_reason(
ws, ws,