From 411f731ba59265a12e7824b8163b9c4ba9c8cef8 Mon Sep 17 00:00:00 2001
From: John Mitchell <6656977+StarArawn@users.noreply.github.com>
Date: Tue, 2 May 2023 22:44:17 -0400
Subject: [PATCH] Fixed clippy errors.

---
 src/styles/units.rs                  | 27 ++++++---------------------
 src/widgets/scroll/scroll_context.rs |  9 ++-------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/src/styles/units.rs b/src/styles/units.rs
index eab69b5..439ab70 100644
--- a/src/styles/units.rs
+++ b/src/styles/units.rs
@@ -1,22 +1,17 @@
 use bevy::reflect::{FromReflect, Reflect};
 
 /// The layout type determines how nodes will be positioned when directed by the parent
-#[derive(Debug, FromReflect, Reflect, Clone, Copy, PartialEq)]
+#[derive(Default, Debug, FromReflect, Reflect, Clone, Copy, PartialEq)]
 pub enum LayoutType {
     /// Stack child elements horizontally
     Row,
+    #[default]
     /// Stack child elements vertically
     Column,
     /// Position child elements into specified rows and columns
     Grid,
 }
 
-impl Default for LayoutType {
-    fn default() -> Self {
-        LayoutType::Column
-    }
-}
-
 impl From<LayoutType> for morphorm::LayoutType {
     fn from(val: LayoutType) -> Self {
         match val {
@@ -28,20 +23,15 @@ impl From<LayoutType> for morphorm::LayoutType {
 }
 
 /// The position type determines whether a node will be positioned in-line with its siblings or seperate
-#[derive(Debug, Reflect, FromReflect, Clone, Copy, PartialEq)]
+#[derive(Default, Debug, Reflect, FromReflect, Clone, Copy, PartialEq)]
 pub enum KPositionType {
     /// Node is positioned relative to parent but ignores its siblings
     SelfDirected,
+    #[default]
     /// Node is positioned relative to parent and in-line with siblings
     ParentDirected,
 }
 
-impl Default for KPositionType {
-    fn default() -> Self {
-        KPositionType::ParentDirected
-    }
-}
-
 impl From<KPositionType> for morphorm::PositionType {
     fn from(val: KPositionType) -> Self {
         match val {
@@ -52,7 +42,7 @@ impl From<KPositionType> for morphorm::PositionType {
 }
 
 /// Units which describe spacing and size
-#[derive(Debug, FromReflect, Reflect, Clone, Copy, PartialEq)]
+#[derive(Default, Debug, FromReflect, Reflect, Clone, Copy, PartialEq)]
 pub enum Units {
     /// A number of pixels
     Pixels(f32),
@@ -60,16 +50,11 @@ pub enum Units {
     Percentage(f32),
     /// A factor of the remaining free space
     Stretch(f32),
+    #[default]
     /// Automatically determine the value
     Auto,
 }
 
-impl Default for Units {
-    fn default() -> Self {
-        Units::Auto
-    }
-}
-
 impl From<Units> for morphorm::Units {
     fn from(val: Units) -> Self {
         match val {
diff --git a/src/widgets/scroll/scroll_context.rs b/src/widgets/scroll/scroll_context.rs
index 71bbd60..3e8b645 100644
--- a/src/widgets/scroll/scroll_context.rs
+++ b/src/widgets/scroll/scroll_context.rs
@@ -26,20 +26,15 @@ pub struct ScrollContext {
 }
 
 #[non_exhaustive]
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
 pub enum ScrollMode {
     /// Clamps the scroll offset to stay within the scroll range
+    #[default]
     Clamped,
     /// Allows infinite scrolling
     Infinite,
 }
 
-impl Default for ScrollMode {
-    fn default() -> Self {
-        ScrollMode::Clamped
-    }
-}
-
 impl ScrollContext {
     /// Get the current x-axis scroll offset
     pub fn scroll_x(&self) -> f32 {
-- 
GitLab