From 2bb5efd9bbec9e2512e33466afe6562f0373ff15 Mon Sep 17 00:00:00 2001 From: sparshg <43041139+sparshg@users.noreply.github.com> Date: Sun, 6 Oct 2024 00:47:39 +0530 Subject: [PATCH] fmt, clippy --- src/game.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/game.rs b/src/game.rs index e934682..20696cf 100644 --- a/src/game.rs +++ b/src/game.rs @@ -94,9 +94,7 @@ pub async fn join_room(sid: Sid, code: String, pool: &sqlx::PgPool) -> Result<() if [room.player1_id.as_ref(), room.player2_id.as_ref()] .into_iter() .flatten() - .filter(|&x| x == sid) - .next() - .is_some() + .any(|x| x == sid) { // if game was over, set status to waiting and return if room.stat == Status::GameOver { @@ -335,9 +333,13 @@ pub async fn attack( .execute(&mut *txn) .await?; } - + txn.commit().await?; - Ok((hit, if hit { board.has_sunk((i, j)) } else { None }, game_over)) + Ok(( + hit, + if hit { board.has_sunk((i, j)) } else { None }, + game_over, + )) } pub async fn update_sid(oldsid: &str, newsid: &str, pool: &sqlx::PgPool) -> Result<()> {