fmt, clippy
This commit is contained in:
10
src/game.rs
10
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()]
|
if [room.player1_id.as_ref(), room.player2_id.as_ref()]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.filter(|&x| x == sid)
|
.any(|x| x == sid)
|
||||||
.next()
|
|
||||||
.is_some()
|
|
||||||
{
|
{
|
||||||
// if game was over, set status to waiting and return
|
// if game was over, set status to waiting and return
|
||||||
if room.stat == Status::GameOver {
|
if room.stat == Status::GameOver {
|
||||||
@@ -337,7 +335,11 @@ pub async fn attack(
|
|||||||
}
|
}
|
||||||
|
|
||||||
txn.commit().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<()> {
|
pub async fn update_sid(oldsid: &str, newsid: &str, pool: &sqlx::PgPool) -> Result<()> {
|
||||||
|
Reference in New Issue
Block a user