From a6aba750ddf06b8bfb0b698d70cb689a6b1514ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ribaud?= Date: Sat, 21 May 2022 17:01:45 +0000 Subject: [PATCH] fix: Fix clippy warnings --- client/src/collision.rs | 6 +++--- client/src/network.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/collision.rs b/client/src/collision.rs index 7f9048d..5818d33 100644 --- a/client/src/collision.rs +++ b/client/src/collision.rs @@ -15,7 +15,7 @@ pub fn is_collided(obj1: &A, obj2: &B) -> bool { } pub fn manage_collisions( - players: &mut Vec, + players: &mut [Ship], asteroids: &mut Asteroids, name: String, god: bool, @@ -23,7 +23,7 @@ pub fn manage_collisions( frame_t: f64, sync_t: f64, ) { - let mut opponents = players.clone(); + let mut opponents = players.to_vec(); for ship in players.iter_mut() { ship_vs_asteroids(ship, asteroids, name.clone(), god, mode, sync_t); ship_vs_opponents(ship, &mut opponents); @@ -101,7 +101,7 @@ fn ship_bullet_vs_asteroid( } } -fn ship_vs_opponents(ship: &mut Ship, opponents: &mut Vec) { +fn ship_vs_opponents(ship: &mut Ship, opponents: &mut [Ship]) { for opponent in opponents.iter_mut() { if opponent.name() != ship.name() { ship_bullet_vs_opponents(ship, opponent); diff --git a/client/src/network.rs b/client/src/network.rs index 7c313c8..1cf5fd1 100644 --- a/client/src/network.rs +++ b/client/src/network.rs @@ -108,12 +108,12 @@ pub fn deserialize_host_data( pub fn serialize_host_data( asteroids: &mut Asteroids, - players: &mut Vec, + players: &mut [Ship], gameover: &mut bool, ) -> String { let gamedata = GameData { asteroids: asteroids.clone(), - players: players.clone(), + players: players.to_vec(), gameover: *gameover, };