From fb85d173a1a9cc58e09460824b0b1021622a88b9 Mon Sep 17 00:00:00 2001 From: IDEDARY Date: Thu, 29 Aug 2024 16:58:59 +0200 Subject: [PATCH 1/2] Run cargo clippy on the crate --- crates/bevy_lunex/src/lib.rs | 2 + crates/bevy_lunex/src/logic/actions.rs | 2 +- crates/bevy_lunex/src/logic/states.rs | 26 +- crates/bevy_lunex/src/logic/style.rs | 2 +- crates/bevy_lunex/src/picking.rs | 2 +- crates/bevy_lunex/src/structs.rs | 30 +- crates/bevy_lunex/src/systems.rs | 14 +- crates/lunex_engine/src/core/compute.rs | 2 +- crates/lunex_engine/src/core/structs.rs | 18 +- crates/lunex_engine/src/core/traits.rs | 27 +- crates/lunex_engine/src/core/value.rs | 124 ++++---- crates/lunex_engine/src/layout/layout.rs | 37 +-- crates/lunex_engine/src/layout/mod.rs | 1 + crates/lunex_engine/src/layout/stack.rs | 17 +- crates/lunex_engine/src/nodes/structs.rs | 26 +- docs/src/advanced/abstraction/routes.md | 2 +- docs/src/quick_start.md | 4 +- examples/mesh2d/src/main.rs | 2 +- examples/minimal/src/main.rs | 2 +- examples/worldspace_text/src/main.rs | 342 +++++++++++------------ 20 files changed, 341 insertions(+), 341 deletions(-) diff --git a/crates/bevy_lunex/src/lib.rs b/crates/bevy_lunex/src/lib.rs index 063c121..54d2b47 100644 --- a/crates/bevy_lunex/src/lib.rs +++ b/crates/bevy_lunex/src/lib.rs @@ -1,4 +1,6 @@ #![doc = include_str!("../README.md")] +#![allow(clippy::type_complexity)] +#![allow(clippy::too_many_arguments)] // #==============================# // #=== IMPORTS FOR THIS CRATE ===# diff --git a/crates/bevy_lunex/src/logic/actions.rs b/crates/bevy_lunex/src/logic/actions.rs index 5f472fd..7817b0a 100644 --- a/crates/bevy_lunex/src/logic/actions.rs +++ b/crates/bevy_lunex/src/logic/actions.rs @@ -187,7 +187,7 @@ pub struct SetUiLayout { fn apply_event_set_ui_layout(mut events: EventReader, mut query: Query<&mut UiLayout>) { for event in events.read() { if let Ok(mut layout) = query.get_mut(event.target) { - if layout.clone() != event.layout{ + if *layout != event.layout{ *layout = event.layout; } } diff --git a/crates/bevy_lunex/src/logic/states.rs b/crates/bevy_lunex/src/logic/states.rs index 34a7f09..a1a4413 100644 --- a/crates/bevy_lunex/src/logic/states.rs +++ b/crates/bevy_lunex/src/logic/states.rs @@ -51,14 +51,7 @@ pub struct UiAnimator { impl UiAnimator { /// Creates new struct pub fn new() -> Self { - UiAnimator { - marker: PhantomData, - animation_direction: -1.0, - animation_transition: 0.0, - receiver: false, - animation_speed_backward: 8.0, - animation_speed_forward: 8.0, - } + Self::default() } /// Marks this hover as receiver pub fn receiver(mut self, receiver: bool) -> Self { @@ -80,6 +73,18 @@ impl UiAnimator { self.animation_direction == 1.0 } } +impl Default for UiAnimator { + fn default() -> Self { + Self { + marker: PhantomData, + animation_direction: -1.0, + animation_transition: 0.0, + receiver: false, + animation_speed_backward: 8.0, + animation_speed_forward: 8.0, + } + } +} fn ui_animation(time: Res