Skip to content

Commit

Permalink
Merge pull request #136 from uggla/fix_clippy
Browse files Browse the repository at this point in the history
Fix clippy warnings
  • Loading branch information
uggla authored May 29, 2022
2 parents 7348094 + a6aba75 commit 639ab82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions client/src/collision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ pub fn is_collided<A: Collided, B: Collided>(obj1: &A, obj2: &B) -> bool {
}

pub fn manage_collisions(
players: &mut Vec<Ship>,
players: &mut [Ship],
asteroids: &mut Asteroids,
name: String,
god: bool,
mode: &str,
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);
Expand Down Expand Up @@ -101,7 +101,7 @@ fn ship_bullet_vs_asteroid(
}
}

fn ship_vs_opponents(ship: &mut Ship, opponents: &mut Vec<Ship>) {
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);
Expand Down
4 changes: 2 additions & 2 deletions client/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ pub fn deserialize_host_data(

pub fn serialize_host_data(
asteroids: &mut Asteroids,
players: &mut Vec<Ship>,
players: &mut [Ship],
gameover: &mut bool,
) -> String {
let gamedata = GameData {
asteroids: asteroids.clone(),
players: players.clone(),
players: players.to_vec(),
gameover: *gameover,
};

Expand Down

0 comments on commit 639ab82

Please sign in to comment.