Commit 8e0c2210 authored by Rahix's avatar Rahix 🦀

Remove redundant clone() calls

parent a7a3172f
......@@ -105,7 +105,7 @@ impl CollisionWorld {
pub fn interferences_with_point(&self, point: &nalgebra::Point2<f32>) -> Vec<legion::Entity> {
self.world
.interferences_with_point(point, &pipeline::CollisionGroups::new())
.map(|(_, collision_object)| collision_object.data().clone())
.map(|(_, collision_object)| *collision_object.data())
.collect()
}
}
......
......@@ -95,7 +95,7 @@ pub fn draw_nodes(
if let Some(ping_time) = node.ping_time {
let radius = (time - ping_time) * 180.0 + 18.0;
let alpha = (1.0 - (time - ping_time) * 2.0).max(0.0).powi(2);
let mut ring_color = node_color.clone();
let mut ring_color = node_color;
ring_color.alpha = alpha;
rendering.begin_path();
......
......@@ -111,7 +111,7 @@ impl gamestate::State for InGameState {
fn event(&mut self, event: gamestate::Event) -> gamestate::Transition {
use legion::IntoQuery;
let player_id = self.resources.get::<resources::Player>().unwrap().0.clone();
let player_id = self.resources.get::<resources::Player>().unwrap().0;
let (player_movable, player) =
<(&mut components::Movable, &mut components::Player)>::query()
.get_mut(&mut self.world, player_id)
......@@ -175,7 +175,7 @@ impl gamestate::State for InGameState {
let game_manager = self.resources.get::<resources::GameManager>().unwrap();
if game_manager.wants_return_to_heaven() {
let player_ent = self.resources.get::<resources::Player>().unwrap().0.clone();
let player_ent = self.resources.get::<resources::Player>().unwrap().0;
let player: &components::Player = <&components::Player>::query()
.get(&self.world, player_ent)
.unwrap();
......
......@@ -23,7 +23,7 @@ pub fn move_movable(
#[resource] clock: &resources::Clock,
#[resource] collision_world: &colliders::CollisionWorld,
) {
let mut actual_velocity = movable.velocity.clone();
let mut actual_velocity = movable.velocity;
if actual_velocity == nalgebra::Vector2::new(0.0, 0.0) {
return;
......@@ -38,7 +38,7 @@ pub fn move_movable(
.contacts_with(collider.handle.unwrap(), false)
.unwrap()
.filter_map(|pair| pair.3.deepest_contact())
.map(|contact| contact.contact.normal.clone())
.map(|contact| contact.contact.normal)
.collect();
for normal in normals.iter() {
......
......@@ -28,7 +28,7 @@ fn contain(
) -> (nalgebra::Vector2<f64>, nalgebra::Vector2<f64>) {
let client_ratio = child.x / child.y;
let parent_ratio = parent.x / parent.y;
let mut child_resized = parent.clone();
let mut child_resized = parent;
if client_ratio > parent_ratio {
child_resized.y = child_resized.x / client_ratio;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment