diff --git a/deny.toml b/deny.toml index b1a11ec1f3..62cadb29ea 100644 --- a/deny.toml +++ b/deny.toml @@ -18,7 +18,8 @@ allow = [ "CC0-1.0", "ISC", "BSD-2-Clause", - "MPL-2.0", # TODO(zicklag): I believe MPL is fine for us, but maybe double-check this. + "BSD-2-Clause-Patent", + "MPL-2.0", "OpenSSL", ] default = "deny" diff --git a/src/core.rs b/src/core.rs index b2287de4d2..62bb261781 100644 --- a/src/core.rs +++ b/src/core.rs @@ -127,7 +127,7 @@ impl SessionRunner for JumpyDefaultMatchRunner { let Some(source) = &player_input.control_source else { return; }; - player_input.control = input.get(source).unwrap().clone(); + player_input.control = *input.get(source).unwrap(); }); } diff --git a/src/core/map.rs b/src/core/map.rs index bf446d6325..e8dfdae104 100644 --- a/src/core/map.rs +++ b/src/core/map.rs @@ -120,17 +120,17 @@ impl From for IVec2 { } impl std::cmp::Ord for NavNode { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.partial_cmp(other).unwrap() - } -} -impl std::cmp::PartialOrd for NavNode { - fn partial_cmp(&self, other: &Self) -> Option { let xcmp = self.0.x.cmp(&other.0.x); - Some(if xcmp == std::cmp::Ordering::Equal { + if xcmp == std::cmp::Ordering::Equal { self.0.y.cmp(&other.0.y) } else { xcmp - }) + } + } +} +impl std::cmp::PartialOrd for NavNode { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) } } diff --git a/src/core/physics/collisions/shape.rs b/src/core/physics/collisions/shape.rs index 53aa9fa954..343e45e3e9 100644 --- a/src/core/physics/collisions/shape.rs +++ b/src/core/physics/collisions/shape.rs @@ -94,10 +94,15 @@ impl std::hash::Hash for ColliderShape { impl PartialOrd for ColliderShape { fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} +impl Ord for ColliderShape { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { use ordered_float::OrderedFloat as F; use std::cmp::Ordering::*; - Some(match self { + match self { ColliderShape::Circle { diameter: r1 } => match other { ColliderShape::Circle { diameter: r2 } => F(*r1).cmp(&F(*r2)), ColliderShape::Rectangle { .. } => Less, @@ -113,11 +118,6 @@ impl PartialOrd for ColliderShape { } ColliderShape::Circle { .. } => Greater, }, - }) - } -} -impl Ord for ColliderShape { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.partial_cmp(other).unwrap() + } } } diff --git a/src/ui/main_menu/player_select.rs b/src/ui/main_menu/player_select.rs index 44e6da33fb..a48bc57436 100644 --- a/src/ui/main_menu/player_select.rs +++ b/src/ui/main_menu/player_select.rs @@ -313,7 +313,7 @@ fn player_select_panel( // If the handle is empty if *player_handle == default() { // Select the first player - *player_handle = meta.core.players[0].clone(); + *player_handle = meta.core.players[0]; } // Handle player joining @@ -390,7 +390,7 @@ fn player_select_panel( .map(|x| if x == 0 { None } else { Some(x - 1) }) .unwrap_or(Some(meta.core.player_hats.len() - 1)) }; - slot.selected_hat = next_idx.map(|idx| meta.core.player_hats.get(idx).unwrap().clone()); + slot.selected_hat = next_idx.map(|idx| *meta.core.player_hats.get(idx).unwrap()); // #[cfg(not(target_arch = "wasm32"))] // if let Some(socket) = ¶ms.network_socket { @@ -418,7 +418,7 @@ fn player_select_panel( .players .get(current_player_handle_idx + 1) .cloned() - .unwrap_or_else(|| meta.core.players[0].clone()); + .unwrap_or_else(|| meta.core.players[0]); } else if direction.x <= 0.0 { if current_player_handle_idx > 0 { *player_handle = meta @@ -428,7 +428,7 @@ fn player_select_panel( .cloned() .unwrap(); } else { - *player_handle = meta.core.players.iter().last().unwrap().clone(); + *player_handle = *meta.core.players.iter().last().unwrap(); } } @@ -607,7 +607,7 @@ fn player_select_panel( slot.active = true; let rand_idx = THREAD_RNG.with(|rng| rng.usize(0..meta.core.players.len())); - slot.selected_player = meta.core.players[rand_idx].clone(); + slot.selected_player = meta.core.players[rand_idx]; } } });