From 2a481195d356d650bb5e13898c62e83a60a2b7c0 Mon Sep 17 00:00:00 2001
From: John Mitchell <6656977+StarArawn@users.noreply.github.com>
Date: Sat, 29 Apr 2023 16:05:40 -0400
Subject: [PATCH] Clippy is here..

---
 .github/workflows/rust.yml                    |  2 +
 clippy.toml                                   |  3 +
 examples/main_menu.rs                         |  4 +-
 examples/transitions.rs                       |  2 +-
 kayak_font/Cargo.toml                         |  2 +-
 kayak_font/src/bevy/font_texture.rs           |  7 +-
 .../src/bevy/renderer/font_texture_cache.rs   | 37 +++++------
 kayak_font/src/font.rs                        |  3 +-
 kayak_font/src/glyph.rs                       |  1 +
 kayak_font/src/msdf/contour.rs                |  2 +-
 kayak_font/src/msdf/edge_coloring.rs          | 15 +++--
 kayak_font/src/msdf/edge_segment/cubic.rs     | 14 ++--
 .../src/msdf/edge_segment/equation_solver.rs  | 10 +--
 kayak_font/src/msdf/edge_segment/line.rs      |  4 +-
 kayak_font/src/msdf/edge_segment/mod.rs       | 64 +++++++++----------
 kayak_font/src/msdf/edge_segment/quadratic.rs | 12 ++--
 kayak_font/src/msdf/gen.rs                    |  4 +-
 kayak_font/src/msdf/mod.rs                    |  1 +
 kayak_font/src/msdf/shape.rs                  |  2 +-
 kayak_font/src/msdf/vector.rs                 | 27 ++++----
 kayak_font/src/ttf/loader.rs                  | 38 ++++++-----
 kayak_ui_macros/src/children.rs               | 11 +---
 src/calculate_nodes.rs                        |  4 +-
 src/camera/mod.rs                             |  2 +-
 src/context.rs                                | 27 ++++----
 src/event_dispatcher.rs                       | 54 ++++++++--------
 src/input.rs                                  | 19 +++---
 src/render/extract.rs                         | 20 +++---
 src/render/font/extract.rs                    |  2 +-
 src/render/mod.rs                             | 21 +++---
 src/render/unified/pipeline.rs                | 20 +++---
 src/styles/mod.rs                             | 25 ++++----
 src/styles/style.rs                           | 20 +++---
 src/styles/units.rs                           | 58 +++++++----------
 src/tree.rs                                   | 23 +++----
 src/widget.rs                                 |  4 +-
 src/widgets/accordion/context.rs              |  8 ++-
 src/widgets/accordion/summary.rs              |  7 +-
 src/widgets/button.rs                         |  2 +-
 src/widgets/icons/mod.rs                      |  4 +-
 src/widgets/modal.rs                          |  4 +-
 src/widgets/scroll/scroll_bar.rs              | 23 +++----
 src/widgets/scroll/scroll_box.rs              | 39 ++++++-----
 src/widgets/text_box.rs                       |  4 +-
 44 files changed, 304 insertions(+), 351 deletions(-)
 create mode 100644 clippy.toml

diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index f3add74..1fccab4 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -38,3 +38,5 @@ jobs:
 #       run: cargo test --verbose --workspace
     - name: Run fmt check
       run: cargo fmt --all -- --check
+    - name: Run clippy
+      run: cargo clippy --no-deps -- -D warnings
diff --git a/clippy.toml b/clippy.toml
new file mode 100644
index 0000000..da8a02c
--- /dev/null
+++ b/clippy.toml
@@ -0,0 +1,3 @@
+# BLOCKED: https://github.com/rust-lang/cargo/issues/5034 for properly disabling lints
+type-complexity-threshold = 9000
+too-many-arguments-threshold = 30
\ No newline at end of file
diff --git a/examples/main_menu.rs b/examples/main_menu.rs
index a0ab3f3..dc75a5a 100644
--- a/examples/main_menu.rs
+++ b/examples/main_menu.rs
@@ -143,8 +143,8 @@ fn startup(
     preload_resource.images.extend(vec![
         panel1_image.clone(),
         logo_image.clone(),
-        button_image.clone(),
-        button_image_hover.clone(),
+        button_image,
+        button_image_hover,
     ]);
 
     let handle_click_close = OnEvent::new(
diff --git a/examples/transitions.rs b/examples/transitions.rs
index 2e55d3a..1f5bd0b 100644
--- a/examples/transitions.rs
+++ b/examples/transitions.rs
@@ -153,7 +153,7 @@ fn startup(
                     },
                     style_b: KStyle {
                         width: Units::Pixels(100.0).into(),
-                        ..quad_styles.clone()
+                        ..quad_styles
                     },
                     ..Default::default()
                 }}
diff --git a/kayak_font/Cargo.toml b/kayak_font/Cargo.toml
index 8d5ea34..42942d1 100644
--- a/kayak_font/Cargo.toml
+++ b/kayak_font/Cargo.toml
@@ -16,7 +16,7 @@ bevy_renderer = ["bevy"]
 
 [dependencies]
 anyhow = { version = "1.0" }
-nanoserde = "0.1.30"
+nanoserde = "0.1.32"
 unicode-segmentation = "1.10.0"
 num = "0.4"
 num-derive = "0.3"
diff --git a/kayak_font/src/bevy/font_texture.rs b/kayak_font/src/bevy/font_texture.rs
index 1b4b43a..c2b32ac 100644
--- a/kayak_font/src/bevy/font_texture.rs
+++ b/kayak_font/src/bevy/font_texture.rs
@@ -11,11 +11,8 @@ pub fn init_font_texture(
 ) {
     // quick and dirty, run this for all textures anytime a texture is created.
     for event in font_events.iter() {
-        match event {
-            AssetEvent::Created { handle } => {
-                not_processed.push(handle.clone_weak());
-            }
-            _ => (),
+        if let AssetEvent::Created { handle } = event {
+            not_processed.push(handle.clone_weak());
         }
     }
 
diff --git a/kayak_font/src/bevy/renderer/font_texture_cache.rs b/kayak_font/src/bevy/renderer/font_texture_cache.rs
index ff8f851..c61a329 100644
--- a/kayak_font/src/bevy/renderer/font_texture_cache.rs
+++ b/kayak_font/src/bevy/renderer/font_texture_cache.rs
@@ -63,12 +63,10 @@ impl FontTextureCache {
     ) -> Option<&'s GpuImage> {
         if let Some(gpu_image) = self.images.get(handle) {
             Some(gpu_image)
+        } else if let Some(font) = self.fonts.get(handle) {
+            render_images.get(font.image.get())
         } else {
-            if let Some(font) = self.fonts.get(handle) {
-                render_images.get(font.image.get())
-            } else {
-                None
-            }
+            None
         }
     }
 
@@ -86,20 +84,18 @@ impl FontTextureCache {
                     if render_images.get(font.image.get()).is_none() {
                         was_processed = false;
                     }
+                } else if let Some(atlas_texture) = render_images.get(font.image.get()) {
+                    Self::create_from_atlas(
+                        &mut self.images,
+                        &font.sdf,
+                        kayak_font_handle.clone_weak(),
+                        device,
+                        queue,
+                        atlas_texture,
+                        font.sdf.max_glyph_size().into(),
+                    );
                 } else {
-                    if let Some(atlas_texture) = render_images.get(font.image.get()) {
-                        Self::create_from_atlas(
-                            &mut self.images,
-                            &font.sdf,
-                            kayak_font_handle.clone_weak(),
-                            device,
-                            queue,
-                            atlas_texture,
-                            font.sdf.max_glyph_size().into(),
-                        );
-                    } else {
-                        was_processed = false;
-                    }
+                    was_processed = false;
                 }
             }
             if !was_processed {
@@ -206,15 +202,14 @@ impl FontTextureCache {
             array_layer_count: std::num::NonZeroU32::new(MAX_CHARACTERS),
         });
 
-        let image = GpuImage {
+        GpuImage {
             texture,
             sampler,
             texture_view,
             mip_level_count: 1,
             size: Vec2 { x: 1.0, y: 1.0 },
             texture_format: TextureFormat::Rgba8Unorm,
-        };
-        image
+        }
     }
 
     pub fn create_from_atlas(
diff --git a/kayak_font/src/font.rs b/kayak_font/src/font.rs
index 49b170f..b5c1187 100644
--- a/kayak_font/src/font.rs
+++ b/kayak_font/src/font.rs
@@ -85,7 +85,7 @@ impl KayakFont {
     }
 
     pub fn get_char_id(&self, c: char) -> Option<u32> {
-        self.char_ids.get(&c).and_then(|id| Some(*id))
+        self.char_ids.get(&c).copied()
     }
 
     pub fn get_word_width(&self, word: &str, properties: TextProperties) -> f32 {
@@ -271,6 +271,7 @@ impl KayakFont {
             let start = line.glyph_index();
             let end = line.glyph_index() + line.total_glyphs();
 
+            #[allow(clippy::needless_range_loop)]
             for index in start..end {
                 let rect = &mut glyph_rects[index];
                 rect.position.0 += shift_x;
diff --git a/kayak_font/src/glyph.rs b/kayak_font/src/glyph.rs
index 0975e26..b67f491 100644
--- a/kayak_font/src/glyph.rs
+++ b/kayak_font/src/glyph.rs
@@ -1,3 +1,4 @@
+#![allow(clippy::needless_question_mark, clippy::question_mark)]
 use nanoserde::{DeJson, DeJsonErr, DeJsonState, SerJson, SerJsonState};
 
 pub struct UnicodeChar(char);
diff --git a/kayak_font/src/msdf/contour.rs b/kayak_font/src/msdf/contour.rs
index dc3f55a..5cba51f 100644
--- a/kayak_font/src/msdf/contour.rs
+++ b/kayak_font/src/msdf/contour.rs
@@ -145,7 +145,7 @@ impl Contour {
                 }
             }
         }
-        return Vector2::sign(total) as i32;
+        Vector2::sign(total) as i32
     }
 
     pub fn bound_miters(
diff --git a/kayak_font/src/msdf/edge_coloring.rs b/kayak_font/src/msdf/edge_coloring.rs
index b74f326..4b559d1 100644
--- a/kayak_font/src/msdf/edge_coloring.rs
+++ b/kayak_font/src/msdf/edge_coloring.rs
@@ -17,7 +17,7 @@ fn estimate_edge_length(edge: &EdgeSegment) -> f64 {
         len += (cur - prev).length();
         prev = cur;
     }
-    return len;
+    len
 }
 
 fn switch_color(color: &mut EdgeColor, seed: &mut usize, banned: EdgeColor) {
@@ -68,6 +68,7 @@ pub fn simple(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
         let edge_count = edges.len();
         if edge_count != 0 {
             let mut prev_dir = edges.last().unwrap().direction(1.0);
+            #[allow(clippy::needless_range_loop)]
             for i in 0..edge_count {
                 let edge = &edges[i];
                 if is_corner(
@@ -81,7 +82,8 @@ pub fn simple(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
             }
         }
 
-        if corners.len() == 0 {
+        if corners.is_empty() {
+            #[allow(clippy::needless_range_loop)]
             for i in 0..edge_count {
                 edges[i].set_color(EdgeColor::WHITE);
             }
@@ -103,7 +105,7 @@ pub fn simple(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
                 let mut parts = [EdgeSegment::default(); 7];
 
                 let (o1, o2, o3) = edges[0].split_in_thirds();
-                parts[0 + 3 * corner] = o1;
+                parts[3 * corner] = o1;
                 parts[1 + 3 * corner] = o2;
                 parts[2 + 3 * corner] = o3;
 
@@ -124,6 +126,7 @@ pub fn simple(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
                     parts[2].set_color(colors[2]);
                 }
                 edges.clear();
+                #[allow(clippy::needless_range_loop)]
                 for i in 0..7 {
                     edges.push(parts[i]);
                 }
@@ -171,6 +174,7 @@ pub fn ink_trap(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
         if !contour.edges.is_empty() {
             let mut prev_direction = contour.edges.last().unwrap().direction(1.0);
             let mut index = 0;
+            #[allow(clippy::explicit_counter_loop)]
             for edge in contour.edges.iter() {
                 if is_corner(
                     prev_direction.normalize(false),
@@ -210,10 +214,10 @@ pub fn ink_trap(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
                         ((3.0 + 2.875 * i as f64 / (m as f64 - 1.0) - 1.4375 + 0.5) as i32 - 3) + 1;
                     contour.edges[(corner + i) % m].set_color(colors[lookup as usize]);
                 }
-            } else if contour.edges.len() >= 1 {
+            } else if !contour.edges.is_empty() {
                 let mut parts = vec![EdgeSegment::default(); 7];
                 let (o1, o2, o3) = contour.edges[0].split_in_thirds();
-                parts[0 + 3 * corner] = o1;
+                parts[3 * corner] = o1;
                 parts[1 + 3 * corner] = o2;
                 parts[2 + 3 * corner] = o3;
                 if contour.edges.len() >= 2 {
@@ -258,6 +262,7 @@ pub fn ink_trap(shape: &mut Shape, angle_threshold: f64, mut seed: usize) {
 
                     let mut color = EdgeColor::WHITE;
                     let mut initial_color = EdgeColor::BLACK;
+                    #[allow(clippy::needless_range_loop)]
                     for i in 0..corner_count {
                         if !corners[i].minor {
                             major_corner_count -= 1;
diff --git a/kayak_font/src/msdf/edge_segment/cubic.rs b/kayak_font/src/msdf/edge_segment/cubic.rs
index 21444bf..afaaae9 100644
--- a/kayak_font/src/msdf/edge_segment/cubic.rs
+++ b/kayak_font/src/msdf/edge_segment/cubic.rs
@@ -144,7 +144,7 @@ pub fn signed_distance(
             t -= Vector2::dot_product(qe, d1)
                 / (Vector2::dot_product(d1, d1) + Vector2::dot_product(qe, d2));
 
-            if t < 0.0 || t > 1.0 {
+            if !(0.0..=1.0).contains(&t) {
                 break;
             }
 
@@ -177,10 +177,10 @@ pub fn signed_distance(
         }
     }
 
-    if param >= 0.0 && param <= 1.0 {
-        return (SignedDistance::new(min_distance, 0.0), param);
+    if (0.0..=1.0).contains(&param) {
+        (SignedDistance::new(min_distance, 0.0), param)
     } else if param < 0.5 {
-        return (
+        (
             SignedDistance::new(
                 min_distance,
                 fabs(Vector2::dot_product(
@@ -189,9 +189,9 @@ pub fn signed_distance(
                 )),
             ),
             param,
-        );
+        )
     } else {
-        return (
+        (
             SignedDistance::new(
                 min_distance,
                 fabs(Vector2::dot_product(
@@ -200,6 +200,6 @@ pub fn signed_distance(
                 )),
             ),
             param,
-        );
+        )
     }
 }
diff --git a/kayak_font/src/msdf/edge_segment/equation_solver.rs b/kayak_font/src/msdf/edge_segment/equation_solver.rs
index 6e71ee2..b0313c3 100644
--- a/kayak_font/src/msdf/edge_segment/equation_solver.rs
+++ b/kayak_font/src/msdf/edge_segment/equation_solver.rs
@@ -22,12 +22,12 @@ pub fn solve_quadratic(a: f64, b: f64, c: f64) -> (i32, [f64; 3]) {
         dscr = dscr.sqrt();
         result[0] = (-b + dscr) / (2.0 * a);
         result[1] = (-b - dscr) / (2.0 * a);
-        return (2, result);
+        (2, result)
     } else if dscr == 0.0 {
         result[0] = -b / (2.0 * a);
-        return (1, result);
+        (1, result)
     } else {
-        return (0, result);
+        (0, result)
     }
 }
 
@@ -54,7 +54,7 @@ pub fn solve_cubic_norm(mut a: f64, b: f64, c: f64) -> (i32, [f64; 3]) {
         result[0] = q * (t / 3.0).cos() - a;
         result[1] = q * ((t + 2.0 * std::f64::consts::PI) / 3.0).cos() - a;
         result[2] = q * ((t - 2.0 * std::f64::consts::PI) / 3.0).cos() - a;
-        return (3, result);
+        (3, result)
     } else {
         result_a = -(fabs(r) + (r2 - q3).sqrt()).powf(1.0 / 3.0);
         if r < 0.0 {
@@ -68,7 +68,7 @@ pub fn solve_cubic_norm(mut a: f64, b: f64, c: f64) -> (i32, [f64; 3]) {
         if fabs(result[2]) < EPSILON {
             return (2, result);
         }
-        return (1, result);
+        (1, result)
     }
 }
 
diff --git a/kayak_font/src/msdf/edge_segment/line.rs b/kayak_font/src/msdf/edge_segment/line.rs
index 639b262..bbf0857 100644
--- a/kayak_font/src/msdf/edge_segment/line.rs
+++ b/kayak_font/src/msdf/edge_segment/line.rs
@@ -40,11 +40,11 @@ pub fn signed_distance(p0: Vector2, p1: Vector2, origin: Vector2) -> (SignedDist
             return (SignedDistance::new(ortho_distance, 0.0), param);
         }
     }
-    return (
+    (
         SignedDistance::new(
             non_zero_sign(Vector2::cross_product(aq, ab)) as f64 * endpoint_distance,
             Vector2::dot_product(ab.normalize(false), eq.normalize(false)).abs(),
         ),
         param,
-    );
+    )
 }
diff --git a/kayak_font/src/msdf/edge_segment/mod.rs b/kayak_font/src/msdf/edge_segment/mod.rs
index 41411b4..c80df31 100644
--- a/kayak_font/src/msdf/edge_segment/mod.rs
+++ b/kayak_font/src/msdf/edge_segment/mod.rs
@@ -6,7 +6,7 @@ mod line;
 mod quadratic;
 
 pub fn non_zero_sign(n: f64) -> i32 {
-    return 2 * (if n > 0.0 { 1 } else { 0 }) - 1;
+    2 * (if n > 0.0 { 1 } else { 0 }) - 1
 }
 pub fn mix(a: Vector2, b: Vector2, weight: f64) -> Vector2 {
     Vector2::new(
@@ -17,18 +17,18 @@ pub fn mix(a: Vector2, b: Vector2, weight: f64) -> Vector2 {
 
 #[derive(Debug, Clone, Copy)]
 pub enum EdgeSegment {
-    LineSegment {
+    Line {
         color: EdgeColor,
         p0: Vector2,
         p1: Vector2,
     },
-    QuadraticSegment {
+    Quadratic {
         color: EdgeColor,
         p0: Vector2,
         p1: Vector2,
         p2: Vector2,
     },
-    CubicSegment {
+    Cubic {
         color: EdgeColor,
         p0: Vector2,
         p1: Vector2,
@@ -39,7 +39,7 @@ pub enum EdgeSegment {
 
 impl Default for EdgeSegment {
     fn default() -> Self {
-        EdgeSegment::LineSegment {
+        EdgeSegment::Line {
             color: EdgeColor::WHITE,
             p0: Vector2::default(),
             p1: Vector2::default(),
@@ -49,14 +49,14 @@ impl Default for EdgeSegment {
 
 impl EdgeSegment {
     pub fn new_linear(p0: Vector2, p1: Vector2, color: EdgeColor) -> Self {
-        Self::LineSegment { p0, p1, color }
+        Self::Line { p0, p1, color }
     }
 
     pub fn new_quadratic(p0: Vector2, mut p1: Vector2, p2: Vector2, color: EdgeColor) -> Self {
         if p1 == p0 || p1 == p2 {
             p1 = 0.5 * (p0 + p2);
         }
-        Self::QuadraticSegment { p0, p1, p2, color }
+        Self::Quadratic { p0, p1, p2, color }
     }
 
     pub fn new_cubic(
@@ -70,7 +70,7 @@ impl EdgeSegment {
             p1 = mix(p0, p3, 1.0 / 3.0);
             p2 = mix(p0, p3, 2.0 / 3.0);
         }
-        Self::CubicSegment {
+        Self::Cubic {
             p0,
             p1,
             p2,
@@ -110,27 +110,27 @@ impl EdgeSegment {
 
     pub fn direction(&self, param: f64) -> Vector2 {
         match *self {
-            Self::LineSegment { p0, p1, .. } => line::direction(p0, p1, param),
-            Self::QuadraticSegment { p0, p1, p2, .. } => quadratic::direction(p0, p1, p2, param),
-            Self::CubicSegment { p0, p1, p2, p3, .. } => cubic::direction(p0, p1, p2, p3, param),
+            Self::Line { p0, p1, .. } => line::direction(p0, p1, param),
+            Self::Quadratic { p0, p1, p2, .. } => quadratic::direction(p0, p1, p2, param),
+            Self::Cubic { p0, p1, p2, p3, .. } => cubic::direction(p0, p1, p2, p3, param),
         }
     }
 
     pub fn point(&self, param: f64) -> Vector2 {
         match *self {
-            Self::LineSegment { p0, p1, .. } => line::point(p0, p1, param),
-            Self::QuadraticSegment { p0, p1, p2, .. } => quadratic::point(p0, p1, p2, param),
-            Self::CubicSegment { p0, p1, p2, p3, .. } => cubic::point(p0, p1, p2, p3, param),
+            Self::Line { p0, p1, .. } => line::point(p0, p1, param),
+            Self::Quadratic { p0, p1, p2, .. } => quadratic::point(p0, p1, p2, param),
+            Self::Cubic { p0, p1, p2, p3, .. } => cubic::point(p0, p1, p2, p3, param),
         }
     }
 
     pub fn find_bounds(&self, l: &mut f64, b: &mut f64, r: &mut f64, t: &mut f64) {
         match *self {
-            Self::LineSegment { p0, p1, .. } => line::find_bounds(p0, p1, l, b, r, t),
-            Self::QuadraticSegment { p0, p1, p2, .. } => {
+            Self::Line { p0, p1, .. } => line::find_bounds(p0, p1, l, b, r, t),
+            Self::Quadratic { p0, p1, p2, .. } => {
                 quadratic::find_bounds(p0, p1, p2, l, b, r, t)
             }
-            Self::CubicSegment { p0, p1, p2, p3, .. } => {
+            Self::Cubic { p0, p1, p2, p3, .. } => {
                 cubic::find_bounds(p0, p1, p2, p3, l, b, r, t)
             }
         }
@@ -138,11 +138,11 @@ impl EdgeSegment {
 
     pub fn split_in_thirds(&self) -> (EdgeSegment, EdgeSegment, EdgeSegment) {
         match *self {
-            Self::LineSegment { p0, p1, color } => line::split_in_thirds(p0, p1, color),
-            Self::QuadraticSegment { p0, p1, p2, color } => {
+            Self::Line { p0, p1, color } => line::split_in_thirds(p0, p1, color),
+            Self::Quadratic { p0, p1, p2, color } => {
                 quadratic::split_in_thirds(p0, p1, p2, color)
             }
-            Self::CubicSegment {
+            Self::Cubic {
                 p0,
                 p1,
                 p2,
@@ -154,11 +154,11 @@ impl EdgeSegment {
 
     pub fn signed_distance(&self, origin: Vector2) -> (SignedDistance, f64) {
         match *self {
-            Self::LineSegment { p0, p1, .. } => line::signed_distance(p0, p1, origin),
-            Self::QuadraticSegment { p0, p1, p2, .. } => {
+            Self::Line { p0, p1, .. } => line::signed_distance(p0, p1, origin),
+            Self::Quadratic { p0, p1, p2, .. } => {
                 quadratic::signed_distance(p0, p1, p2, origin)
             }
-            Self::CubicSegment { p0, p1, p2, p3, .. } => {
+            Self::Cubic { p0, p1, p2, p3, .. } => {
                 cubic::signed_distance(p0, p1, p2, p3, origin)
             }
         }
@@ -166,25 +166,25 @@ impl EdgeSegment {
 
     pub fn has_color(&self, c: EdgeColor) -> bool {
         match *self {
-            Self::LineSegment { color, .. } => color as usize & c as usize != 0,
-            Self::QuadraticSegment { color, .. } => color as usize & c as usize != 0,
-            Self::CubicSegment { color, .. } => color as usize & c as usize != 0,
+            Self::Line { color, .. } => color as usize & c as usize != 0,
+            Self::Quadratic { color, .. } => color as usize & c as usize != 0,
+            Self::Cubic { color, .. } => color as usize & c as usize != 0,
         }
     }
 
     pub fn get_color(&self) -> EdgeColor {
         match self {
-            Self::LineSegment { color, .. } => *color,
-            Self::QuadraticSegment { color, .. } => *color,
-            Self::CubicSegment { color, .. } => *color,
+            Self::Line { color, .. } => *color,
+            Self::Quadratic { color, .. } => *color,
+            Self::Cubic { color, .. } => *color,
         }
     }
 
     pub fn set_color(&mut self, c: EdgeColor) {
         match self {
-            Self::LineSegment { color, .. } => *color = c,
-            Self::QuadraticSegment { color, .. } => *color = c,
-            Self::CubicSegment { color, .. } => *color = c,
+            Self::Line { color, .. } => *color = c,
+            Self::Quadratic { color, .. } => *color = c,
+            Self::Cubic { color, .. } => *color = c,
         }
     }
 }
diff --git a/kayak_font/src/msdf/edge_segment/quadratic.rs b/kayak_font/src/msdf/edge_segment/quadratic.rs
index c0edbc6..5771a08 100644
--- a/kayak_font/src/msdf/edge_segment/quadratic.rs
+++ b/kayak_font/src/msdf/edge_segment/quadratic.rs
@@ -107,24 +107,24 @@ pub fn signed_distance(
         }
     }
 
-    if param >= 0.0 && param <= 1.0 {
-        return (SignedDistance::new(min_distance, 0.0), param);
+    if (0.0..=1.0).contains(&param) {
+        (SignedDistance::new(min_distance, 0.0), param)
     } else if param < 0.5 {
-        return (
+        (
             SignedDistance::new(
                 min_distance,
                 (Vector2::dot_product(ab.normalize(false), qa.normalize(false))).abs(),
             ),
             param,
-        );
+        )
     } else {
-        return (
+        (
             SignedDistance::new(
                 min_distance,
                 (Vector2::dot_product((p2 - p1).normalize(false), (p2 - origin).normalize(false)))
                     .abs(),
             ),
             param,
-        );
+        )
     }
 }
diff --git a/kayak_font/src/msdf/gen.rs b/kayak_font/src/msdf/gen.rs
index 61cc4f9..8cb8516 100644
--- a/kayak_font/src/msdf/gen.rs
+++ b/kayak_font/src/msdf/gen.rs
@@ -166,9 +166,7 @@ pub fn msdf_error_correction(output: &mut FloatRGBBmp, threshold: Vector2) {
             }
         }
     }
-    let clash_count = clashes.len();
-    for i in 0..clash_count {
-        let clash = clashes[i];
+    for clash in clashes {
         let pixel = output.get_pixel(clash.0, clash.1);
         let med = median(pixel.r, pixel.g, pixel.b);
         output.set_pixel(clash.0, clash.1, FloatRGB::new(med, med, med));
diff --git a/kayak_font/src/msdf/mod.rs b/kayak_font/src/msdf/mod.rs
index a687ffe..4788d60 100644
--- a/kayak_font/src/msdf/mod.rs
+++ b/kayak_font/src/msdf/mod.rs
@@ -12,6 +12,7 @@ pub mod signed_distance;
 pub mod ttf_parser;
 pub mod vector;
 
+#[allow(clippy::upper_case_acronyms)]
 #[derive(Debug, Clone, Copy, PartialEq, FromPrimitive)]
 pub enum EdgeColor {
     BLACK = 0,
diff --git a/kayak_font/src/msdf/shape.rs b/kayak_font/src/msdf/shape.rs
index 5b4d34f..d596bcd 100644
--- a/kayak_font/src/msdf/shape.rs
+++ b/kayak_font/src/msdf/shape.rs
@@ -54,6 +54,6 @@ impl Shape {
         let mut right = LARGE_VALUE;
         let mut top = -LARGE_VALUE;
         self.find_bounds(&mut left, &mut bottom, &mut right, &mut top);
-        return (left, bottom, right, top);
+        (left, bottom, right, top)
     }
 }
diff --git a/kayak_font/src/msdf/vector.rs b/kayak_font/src/msdf/vector.rs
index 34d7a29..e3e8737 100644
--- a/kayak_font/src/msdf/vector.rs
+++ b/kayak_font/src/msdf/vector.rs
@@ -23,25 +23,25 @@ impl Vector2 {
                 Vector2::new(0.0, -allow_zero)
             };
         }
-        return if polarity {
+        if polarity {
             Vector2::new(-self.y / len, self.x / len)
         } else {
             Vector2::new(self.y / len, -self.x / len)
-        };
+        }
     }
 
     pub fn get_orthogonal(&self, polarity: bool) -> Vector2 {
-        return if polarity {
+        if polarity {
             Vector2::new(-self.y, self.x)
         } else {
             Vector2::new(self.y, -self.x)
-        };
+        }
     }
     pub fn dot_product(a: Vector2, b: Vector2) -> f64 {
-        return a.x * b.x + a.y * b.y;
+        a.x * b.x + a.y * b.y
     }
     pub fn cross_product(a: Vector2, b: Vector2) -> f64 {
-        return a.x * b.y - a.y * b.x;
+        a.x * b.y - a.y * b.x
     }
 
     pub fn normalize(&self, allow_zero: bool) -> Vector2 {
@@ -50,32 +50,33 @@ impl Vector2 {
             let allow_zero = if !allow_zero { 1.0 } else { 0.0 };
             return Vector2::new(0.0, allow_zero);
         }
-        return Vector2::new(self.x / len, self.y / len);
+        Vector2::new(self.x / len, self.y / len)
     }
 
     pub fn length(&self) -> f64 {
-        return (self.x * self.x + self.y * self.y).sqrt();
+        (self.x * self.x + self.y * self.y).sqrt()
     }
 
     pub fn clamp(n: i32, b: i32) -> i32 {
         if n > 0 {
-            return if n <= b { n } else { b };
+            if n <= b { n } else { b }
+        } else {
+            0
         }
-        return 0;
     }
 
     pub fn sign(n: f64) -> f64 {
-        return if n == 0.0 {
+        if n == 0.0 {
             0.0
         } else if n > 0.0 {
             1.0
         } else {
             -1.0
-        };
+        }
     }
 
     pub fn shoelace(a: Vector2, b: Vector2) -> f64 {
-        return (b.x - a.x) * (a.y + b.y);
+        (b.x - a.x) * (a.y + b.y)
     }
 
     pub fn point_bounds(p: Vector2, l: &mut f64, b: &mut f64, r: &mut f64, t: &mut f64) {
diff --git a/kayak_font/src/ttf/loader.rs b/kayak_font/src/ttf/loader.rs
index fb0dc19..64b588d 100644
--- a/kayak_font/src/ttf/loader.rs
+++ b/kayak_font/src/ttf/loader.rs
@@ -1,3 +1,4 @@
+#![allow(clippy::needless_question_mark, clippy::question_mark)]
 use bevy::{
     asset::{AssetLoader, LoadContext, LoadedAsset},
     render::render_resource::{Extent3d, TextureFormat},
@@ -17,7 +18,7 @@ use crate::{
 pub struct TTFLoader;
 
 #[derive(DeJson, Default, Debug, Clone)]
-pub struct KTTF {
+pub struct Kttf {
     file: String,
     char_range_start: String,
     char_range_end: String,
@@ -38,7 +39,7 @@ impl AssetLoader for TTFLoader {
                 .downcast_ref::<FileAssetIo>()
                 .unwrap();
 
-            let kttf: KTTF =
+            let kttf: Kttf =
                 nanoserde::DeJson::deserialize_json(std::str::from_utf8(bytes).unwrap()).unwrap();
 
             let char_range_start =
@@ -79,9 +80,9 @@ impl AssetLoader for TTFLoader {
                     subtable.codepoints(|codepoint| {
                         if let Some(mapping) = subtable.glyph_index(codepoint) {
                             glyph_to_char
-                                .insert(mapping, unsafe { std::mem::transmute(codepoint) });
+                                .insert(mapping, std::char::from_u32(codepoint).unwrap());
                             char_to_glyph
-                                .insert(unsafe { std::mem::transmute(codepoint) }, mapping);
+                                .insert(std::char::from_u32(codepoint).unwrap(), mapping);
                         }
                     })
                 }
@@ -134,7 +135,7 @@ impl AssetLoader for TTFLoader {
                     advance: advance * pixel_scale as f32,
                     atlas_bounds: Some(Rect {
                         left: 0.0,
-                        bottom: 0.0 as f32,
+                        bottom: 0.0,
                         right: size_x as f32,
                         top: size_y as f32,
                     }),
@@ -163,7 +164,7 @@ impl AssetLoader for TTFLoader {
                         range,
                         scale,
                         translation + Vector2::new(0.0, size_x as f64 * 1.25),
-                        1.11111111111111111,
+                        1.111_111_111_111_111_2,
                     );
 
                     // let left = (translation.x - char_bounds.x_min as f64 * pixel_scale).max(0.0).floor() as u32;
@@ -198,16 +199,19 @@ impl AssetLoader for TTFLoader {
                 yy += size_y as u32;
             }
 
-            let image_bytes = if cache_image.is_err() {
-                #[cfg(not(target_family = "wasm"))]
-                image_builder
-                    .save(asset_io.root_path().join(cache_path))
-                    .unwrap();
-                image_builder.as_bytes().to_vec()
-            } else {
-                let cache_image = cache_image.unwrap();
-                let image = image::load_from_memory(&cache_image).unwrap();
-                image.as_bytes().to_vec()
+            let image_bytes = match cache_image {
+                Ok(cache_image) => {
+                    let cache_image = cache_image;
+                    let image = image::load_from_memory(&cache_image).unwrap();
+                    image.as_bytes().to_vec()
+                },
+                Err(_) => {
+                    #[cfg(not(target_family = "wasm"))]
+                    image_builder
+                        .save(asset_io.root_path().join(cache_path))
+                        .unwrap();
+                    image_builder.as_bytes().to_vec()
+                }
             };
 
             let mut sdf = Sdf::default();
@@ -241,7 +245,7 @@ impl AssetLoader for TTFLoader {
 }
 
 fn calculate_plane(
-    loaded_file: &KTTF,
+    loaded_file: &Kttf,
     shape: &mut Shape,
     geometry_scale: f32,
     scale: f32,
diff --git a/kayak_ui_macros/src/children.rs b/kayak_ui_macros/src/children.rs
index 627821b..cc17637 100644
--- a/kayak_ui_macros/src/children.rs
+++ b/kayak_ui_macros/src/children.rs
@@ -13,10 +13,7 @@ impl Children {
     }
 
     pub fn is_block(&self) -> bool {
-        self.nodes.iter().any(|node| match node {
-            Child::RawBlock(_) => true,
-            _ => false,
-        })
+        self.nodes.iter().any(|node| matches!(node, Child::RawBlock(..)))
     }
 
     // pub fn get_clonable_attributes(&self, index: usize) -> Vec<proc_macro2::TokenStream> {
@@ -64,10 +61,7 @@ impl Children {
                 (
                     entity_id,
                     quote! { #child },
-                    match child {
-                        Child::Widget(_) => true,
-                        _ => false,
-                    },
+                    matches!(child, Child::Widget(_)),
                     index,
                 )
             })
@@ -165,6 +159,7 @@ impl Children {
 
                 let mut output = Vec::new();
                 // output.push(quote! { #base_clone });
+                #[allow(clippy::needless_range_loop)]
                 for i in 0..children_quotes.len() {
                     // output.push(quote! { #base_clones_inner });
                     let name: proc_macro2::TokenStream = format!("child{}", i).parse().unwrap();
diff --git a/src/calculate_nodes.rs b/src/calculate_nodes.rs
index 1a1548f..9d7b724 100644
--- a/src/calculate_nodes.rs
+++ b/src/calculate_nodes.rs
@@ -273,7 +273,7 @@ fn create_primitive(
                     .font
                     .resolve_or_else(|| String::from(crate::DEFAULT_FONT));
                 // --- Bind to Font Asset --- //
-                let font_handle = font_mapping.get_handle(font.clone()).unwrap();
+                let font_handle = font_mapping.get_handle(font).unwrap();
                 if let Some(font) = fonts.get(&font_handle) {
                     if let Ok(node_tree) = context.tree.try_read() {
                         if let Some(parent_id) =
@@ -300,7 +300,7 @@ fn create_primitive(
                                     font_size,
                                     line_height: styles.line_height.resolve_or(font_size * 1.2),
                                     alignment: *alignment,
-                                    ..properties.clone()
+                                    ..*properties
                                 };
 
                                 properties.max_size = (
diff --git a/src/camera/mod.rs b/src/camera/mod.rs
index f260d64..1e02a53 100644
--- a/src/camera/mod.rs
+++ b/src/camera/mod.rs
@@ -12,7 +12,7 @@ impl ExtractComponent for CameraUIKayak {
     type Out = CameraUIKayak;
 
     fn extract_component(item: QueryItem<Self::Query>) -> Option<Self::Out> {
-        Some(item.clone())
+        Some(*item)
     }
 }
 
diff --git a/src/context.rs b/src/context.rs
index 1e27f41..28673ce 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -143,7 +143,7 @@ impl KayakRootContext {
     /// Retreives the current entity that has focus or None if nothing is focused.
     pub fn get_current_focus(&self) -> Option<Entity> {
         if let Ok(tree) = self.focus_tree.try_read() {
-            return tree.current().and_then(|a| Some(a.0));
+            return tree.current().map(|a| a.0);
         }
         None
     }
@@ -335,7 +335,7 @@ impl KayakRootContext {
                         tree.add(WrappedIndex(entity.unwrap()), parent_id.map(WrappedIndex))
                     }
                 }
-            } else if let Ok(mut tree) = self.order_tree.try_write() {
+            } else if let Ok(_tree) = self.order_tree.try_write() {
                 // let root_node = tree.root_node;
                 // if entity.map(WrappedIndex) != root_node {
                 //     tree.add(entity.map(WrappedIndex).unwrap(), root_node);
@@ -420,7 +420,6 @@ impl KayakRootContext {
                 None,
                 0,
                 0,
-                0,
             );
         }
     }
@@ -444,7 +443,6 @@ fn recurse_node_tree_to_build_primitives(
     _parent_global_z: f32,
     mut current_global_z: f32,
     mut prev_clip: Option<ExtractedQuad>,
-    depth: usize,
     mut current_opacity_layer: u32,
     mut total_opacity_layers: u32,
 ) -> (usize, f32, u32) {
@@ -546,7 +544,6 @@ fn recurse_node_tree_to_build_primitives(
                         current_parent_global_z,
                         current_global_z,
                         prev_clip.clone(),
-                        depth + 1,
                         current_opacity_layer,
                         total_opacity_layers,
                     );
@@ -890,7 +887,7 @@ fn update_widgets(
                                 (unique_ids.try_write(), unique_ids_parents.try_write())
                             {
                                 if let Some(parent) = unique_ids_parents.get(&entity) {
-                                    if let Some(keyed_hashmap) = unique_ids.get_mut(&parent) {
+                                    if let Some(keyed_hashmap) = unique_ids.get_mut(parent) {
                                         let possible_key = keyed_hashmap
                                             .iter()
                                             .find(|(_, keyed_entity)| **keyed_entity == entity)
@@ -1075,9 +1072,9 @@ fn update_widget(
     cloned_widget_entities: &Arc<RwLock<HashMap<Entity, Entity>>>,
     widget_state: &WidgetState,
     new_ticks: &mut HashMap<String, u32>,
-    order_tree: &Arc<RwLock<Tree>>,
-    unique_ids: &Arc<RwLock<HashMap<Entity, HashMap<String, Entity>>>>,
-    unique_ids_parents: &Arc<RwLock<HashMap<Entity, Entity>>>,
+    _order_tree: &Arc<RwLock<Tree>>,
+    _unique_ids: &Arc<RwLock<HashMap<Entity, HashMap<String, Entity>>>>,
+    _unique_ids_parents: &Arc<RwLock<HashMap<Entity, Entity>>>,
 ) -> (Tree, bool) {
     // Check if we should update this widget
     let should_rerender = {
@@ -1120,10 +1117,8 @@ fn update_widget(
 
         let widget_update_system = &mut systems
             .get_mut(&widget_type)
-            .expect(&format!(
-                "Wasn't able to find render/update systems for widget: {}!",
-                widget_type
-            ))
+            .unwrap_or_else(|| panic!("Wasn't able to find render/update systems for widget: {}!",
+                widget_type))
             .0;
         let old_tick = widget_update_system.get_last_change_tick();
 
@@ -1398,8 +1393,8 @@ impl From<String> for WidgetName {
     }
 }
 
-impl Into<String> for WidgetName {
-    fn into(self) -> String {
-        self.0
+impl From<WidgetName> for String {
+    fn from(val: WidgetName) -> Self {
+        val.0
     }
 }
diff --git a/src/event_dispatcher.rs b/src/event_dispatcher.rs
index 61f7c87..a7fcc98 100644
--- a/src/event_dispatcher.rs
+++ b/src/event_dispatcher.rs
@@ -177,7 +177,7 @@ impl EventDispatcher {
     /// Process and dispatch a set of [InputEvents](crate::InputEvent)
     pub(crate) fn process_events(
         &mut self,
-        input_events: &Vec<InputEvent>,
+        input_events: &[InputEvent],
         context: &mut KayakRootContext,
         world: &mut World,
     ) {
@@ -797,39 +797,35 @@ impl EventDispatcher {
         context: &mut KayakRootContext,
         world: &mut World,
     ) {
-        match event.event_type {
-            EventType::KeyDown(evt) => match evt.key() {
-                KeyCode::Tab => {
-                    let (index, current_focus) =
-                        if let Ok(mut focus_tree) = context.focus_tree.try_write() {
-                            let current_focus = focus_tree.current();
-
-                            let index = if evt.is_shift_pressed() {
-                                focus_tree.prev()
-                            } else {
-                                focus_tree.next()
-                            };
-                            (index, current_focus)
+        if let EventType::KeyDown(evt) = event.event_type {
+            if let KeyCode::Tab = evt.key() {
+                let (index, current_focus) =
+                    if let Ok(mut focus_tree) = context.focus_tree.try_write() {
+                        let current_focus = focus_tree.current();
+
+                        let index = if evt.is_shift_pressed() {
+                            focus_tree.prev()
                         } else {
-                            (None, None)
+                            focus_tree.next()
                         };
-
-                    if let Some(index) = index {
-                        let mut events = vec![KEvent::new(index.0, EventType::Focus)];
-                        if let Some(current_focus) = current_focus {
-                            if current_focus != index {
-                                events.push(KEvent::new(current_focus.0, EventType::Blur));
-                            }
-                        }
-                        if let Ok(mut focus_tree) = context.focus_tree.try_write() {
-                            focus_tree.focus(index);
+                        (index, current_focus)
+                    } else {
+                        (None, None)
+                    };
+
+                if let Some(index) = index {
+                    let mut events = vec![KEvent::new(index.0, EventType::Focus)];
+                    if let Some(current_focus) = current_focus {
+                        if current_focus != index {
+                            events.push(KEvent::new(current_focus.0, EventType::Blur));
                         }
-                        self.dispatch_events(events, context, world);
                     }
+                    if let Ok(mut focus_tree) = context.focus_tree.try_write() {
+                        focus_tree.focus(index);
+                    }
+                    self.dispatch_events(events, context, world);
                 }
-                _ => {}
-            },
-            _ => {}
+            }
         }
     }
 
diff --git a/src/input.rs b/src/input.rs
index a131a47..cf51b47 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -18,7 +18,7 @@ pub(crate) fn process_events(world: &mut World) {
     // TODO: Rewrite an process events per window.
     let window_size = if let Ok(window) = world
         .query_filtered::<&Window, With<PrimaryWindow>>()
-        .get_single(&world)
+        .get_single(world)
     {
         Vec2::new(window.width(), window.height())
     } else {
@@ -63,21 +63,18 @@ pub(crate) fn process_events(world: &mut World) {
             {
                 // Currently, we can only handle a single MouseMoved event at a time so everything but the last needs to be skipped
                 input_events.push(InputEvent::MouseMoved((
-                    event.position.x as f32,
-                    window_size.y - event.position.y as f32,
+                    event.position.x,
+                    window_size.y - event.position.y,
                 )));
             }
 
             for event in custom_event_mouse_button.0.iter(&mouse_button_input_events) {
-                match event.button {
-                    MouseButton::Left => {
-                        if event.state == ButtonState::Pressed {
-                            input_events.push(InputEvent::MouseLeftPress);
-                        } else if event.state == ButtonState::Released {
-                            input_events.push(InputEvent::MouseLeftRelease);
-                        }
+                if let MouseButton::Left = event.button {
+                    if event.state == ButtonState::Pressed {
+                        input_events.push(InputEvent::MouseLeftPress);
+                    } else if event.state == ButtonState::Released {
+                        input_events.push(InputEvent::MouseLeftRelease);
                     }
-                    _ => {}
                 }
             }
 
diff --git a/src/render/extract.rs b/src/render/extract.rs
index 8385e75..f9942d8 100644
--- a/src/render/extract.rs
+++ b/src/render/extract.rs
@@ -56,18 +56,14 @@ pub fn extract(
 
     for (_entity, context) in context_query.iter() {
         let dpi = if let Ok(camera) = cameras.get(context.camera_entity) {
-            match &camera.target {
-                bevy::render::camera::RenderTarget::Window(window_ref) => match window_ref {
-                    WindowRef::Primary => {
-                        if let Ok(window) = primary_window.get_single() {
-                            window.scale_factor() as f32
-                        } else {
-                            1.0
-                        }
-                    }
-                    _ => 1.0,
-                },
-                _ => 1.0,
+            if let bevy::render::camera::RenderTarget::Window(WindowRef::Primary) = &camera.target {
+                if let Ok(window) = primary_window.get_single() {
+                    window.scale_factor() as f32
+                } else {
+                    1.0
+                }
+            } else {
+                1.0
             }
         } else {
             1.0
diff --git a/src/render/font/extract.rs b/src/render/font/extract.rs
index 3f16445..1681451 100644
--- a/src/render/font/extract.rs
+++ b/src/render/font/extract.rs
@@ -26,7 +26,7 @@ pub fn extract_texts(
 ) -> Vec<ExtractedQuad> {
     let mut extracted_texts = Vec::new();
 
-    let font_handle = font_mapping.get_handle(font.clone()).unwrap();
+    let font_handle = font_mapping.get_handle(font).unwrap();
     let font = match fonts.get(&font_handle) {
         Some(font) => font,
         None => {
diff --git a/src/render/mod.rs b/src/render/mod.rs
index 58def95..f1da181 100644
--- a/src/render/mod.rs
+++ b/src/render/mod.rs
@@ -185,17 +185,14 @@ pub fn update_opacity_layer_cameras(
     mut images: ResMut<Assets<Image>>,
 ) {
     for (camera_entity, camera) in cameras.iter() {
-        match &camera.target {
-            RenderTarget::Window(window_ref) => {
-                let window_entity = match window_ref {
-                    WindowRef::Entity(entity) => *entity,
-                    WindowRef::Primary => primary_window.get_single().unwrap(),
-                };
-                if let Ok(camera_window) = windows.get(window_entity) {
-                    opacity_layers.add_or_update(&camera_entity, camera_window, &mut images);
-                }
+        if let RenderTarget::Window(window_ref) = &camera.target {
+            let window_entity = match window_ref {
+                WindowRef::Entity(entity) => *entity,
+                WindowRef::Primary => primary_window.get_single().unwrap(),
+            };
+            if let Ok(camera_window) = windows.get(window_entity) {
+                opacity_layers.add_or_update(&camera_entity, camera_window, &mut images);
             }
-            _ => {}
         }
     }
 }
@@ -220,9 +217,9 @@ pub fn extract_core_pipeline_camera_phases(
 
 fn prepare_opacity_layers(
     mut opacity_layers: ResMut<OpacityLayerManager>,
-    mut gpu_images: ResMut<RenderAssets<Image>>,
+    gpu_images: Res<RenderAssets<Image>>,
 ) {
     for (_, layer) in opacity_layers.camera_layers.iter_mut() {
-        layer.set_texture_views(&mut gpu_images);
+        layer.set_texture_views(&gpu_images);
     }
 }
diff --git a/src/render/unified/pipeline.rs b/src/render/unified/pipeline.rs
index 2291065..1f929da 100644
--- a/src/render/unified/pipeline.rs
+++ b/src/render/unified/pipeline.rs
@@ -578,7 +578,7 @@ pub struct QueueQuads<'w, 's> {
     quad_meta: ResMut<'w, QuadMeta>,
     quad_pipeline: Res<'w, UnifiedPipeline>,
     pipelines: ResMut<'w, SpecializedRenderPipelines<UnifiedPipeline>>,
-    pipeline_cache: ResMut<'w, PipelineCache>,
+    pipeline_cache: Res<'w, PipelineCache>,
     extracted_quads: ResMut<'w, ExtractedQuads>,
     views: Query<
         'w,
@@ -610,7 +610,7 @@ pub fn queue_quads(queue_quads: QueueQuads) {
         mut quad_meta,
         quad_pipeline,
         mut pipelines,
-        mut pipeline_cache,
+        pipeline_cache,
         mut extracted_quads,
         mut views,
         mut image_bind_groups,
@@ -663,7 +663,7 @@ pub fn queue_quads(queue_quads: QueueQuads) {
             msaa: 1,
             hdr: view.hdr,
         };
-        let spec_pipeline = pipelines.specialize(&mut pipeline_cache, &quad_pipeline, key);
+        let spec_pipeline = pipelines.specialize(&pipeline_cache, &quad_pipeline, key);
 
         for quad in extracted_quads.iter_mut() {
             if quad.quad_type == UIQuadType::Clip {
@@ -1167,15 +1167,13 @@ impl<T: PhaseItem + TransparentUIGeneric + BatchedPhaseItem> RenderCommand<T> fo
             let image_bind_groups = image_bind_groups.into_inner();
             if let Some(bind_group) = image_bind_groups.values.get(&Handle::weak(*image_handle)) {
                 pass.set_bind_group(1, bind_group, &[]);
+            } else if let Some(bind_group) = image_bind_groups
+                .font_values
+                .get(&Handle::weak(*image_handle))
+            {
+                pass.set_bind_group(1, bind_group, &[]);
             } else {
-                if let Some(bind_group) = image_bind_groups
-                    .font_values
-                    .get(&Handle::weak(*image_handle))
-                {
-                    pass.set_bind_group(1, bind_group, &[]);
-                } else {
-                    pass.set_bind_group(1, &unified_pipeline.default_image.1, &[]);
-                }
+                pass.set_bind_group(1, &unified_pipeline.default_image.1, &[]);
             }
         } else {
             pass.set_bind_group(1, &unified_pipeline.default_image.1, &[]);
diff --git a/src/styles/mod.rs b/src/styles/mod.rs
index f4c5693..34acdd8 100644
--- a/src/styles/mod.rs
+++ b/src/styles/mod.rs
@@ -21,9 +21,9 @@ pub use units::*;
 #[derive(Component, Reflect, Debug, Default, Clone, PartialEq)]
 pub struct ComputedStyles(pub KStyle);
 
-impl Into<ComputedStyles> for KStyle {
-    fn into(self) -> ComputedStyles {
-        ComputedStyles(self)
+impl From<KStyle> for ComputedStyles {
+    fn from(val: KStyle) -> Self {
+        ComputedStyles(val)
     }
 }
 
@@ -47,7 +47,7 @@ impl BoxShadow {
         let box_shadow_string: String = s.to_string();
         let box_shadow_string = box_shadow_string
             .replace("box-shadow: ", "")
-            .replace(";", "");
+            .replace(';', "");
 
         let values_parsed = fancy_regex::Regex::new(r",(?![^\(]*\))").unwrap();
         let split_regex = fancy_regex::Regex::new(r"\s(?![^(]*\))").unwrap();
@@ -60,7 +60,7 @@ impl BoxShadow {
         for value in values_split.map(|s| s.trim()) {
             // Split single shadow
             let parts = Split {
-                finder: split_regex.find_iter(&value),
+                finder: split_regex.find_iter(value),
                 last: 0,
             }
             .collect::<Vec<_>>();
@@ -68,14 +68,14 @@ impl BoxShadow {
             let color = parts
                 .last()
                 .map(|last| {
-                    if last.contains("rgb") || last.contains("#") {
-                        Some(last.clone())
+                    if last.contains("rgb") || last.contains('#') {
+                        Some(*last)
                     } else {
                         None
                     }
                 })
                 .and_then(|s| s)
-                .unwrap_or(parts.first().unwrap().clone());
+                .unwrap_or(parts.first().cloned().unwrap());
 
             let nums = parts
                 .iter()
@@ -84,7 +84,7 @@ impl BoxShadow {
                 .map(|v| v.replace("px", "").parse::<f32>().unwrap_or(0.0))
                 .collect::<Vec<f32>>();
 
-            let offset_x = nums.get(0).copied().unwrap_or(0.0);
+            let offset_x = nums.first().copied().unwrap_or(0.0);
             let offset_y = nums.get(1).copied().unwrap_or(0.0);
             let blur_radius = nums.get(2).copied().unwrap_or(0.0);
             let spread = nums.get(3).copied().unwrap_or(0.0);
@@ -112,11 +112,10 @@ fn is_rgba(s: &str) -> bool {
 }
 
 fn parse_rgba(s: &str) -> Color {
-    let s = s.replace("rgba(", "").replace("rgb(", "").replace(")", "");
-    let values = s.split(",").collect::<Vec<_>>();
+    let s = s.replace("rgba(", "").replace("rgb(", "").replace(')', "");
+    let values = s.split(',').collect::<Vec<_>>();
 
-    let r = values
-        .get(0)
+    let r = values.first()
         .map(|s| s.trim().parse::<f32>().map(|v| v / 255.0).unwrap_or(0.0))
         .unwrap_or(0.0);
     let g = values
diff --git a/src/styles/style.rs b/src/styles/style.rs
index 7b5ae7b..60b697d 100644
--- a/src/styles/style.rs
+++ b/src/styles/style.rs
@@ -678,7 +678,7 @@ fn lerp_ang(a: f32, b: f32, x: f32) -> f32 {
     let ang = ((((a - b) % std::f32::consts::TAU) + std::f32::consts::PI * 3.)
         % std::f32::consts::TAU)
         - std::f32::consts::PI;
-    return ang * x + b;
+    ang * x + b
 }
 
 /// Linear interpolation between two colors in Lch space
@@ -693,13 +693,13 @@ fn lerp_lch(a: Color, b: Color, x: f32) -> Color {
 
     let alpha = lerp(a_a, b_a, x);
 
-    return Color::Lcha {
+    Color::Lcha {
         lightness: xy.x,
         chroma: xy.y,
         hue,
         alpha,
     }
-    .as_rgba();
+    .as_rgba()
 }
 
 fn rgb_to_hsv(from: &Color) -> Vec3 {
@@ -739,7 +739,7 @@ fn rgb_to_hsv(from: &Color) -> Vec3 {
         res.x = 4.0 + (r - g) / delta;
     }
 
-    res.x = res.x * 60.0; // Convert to degrees
+    res.x *= 60.0; // Convert to degrees
     if res.x < 0.0 {
         res.x += 360.0; // Unwrap angle in case of negative
     }
@@ -759,23 +759,23 @@ fn hsv_to_rgb(from: &Vec3) -> Color {
 
     let mut res = Vec4::new(0.0, 0.0, 0.0, 1.0);
 
-    if h >= 0.0 && h < 60.0 {
+    if (0.0..60.0).contains(&h) {
         res.x = c;
         res.y = x;
         res.z = 0.0;
-    } else if h >= 60.0 && h < 120.0 {
+    } else if (60.0..120.0).contains(&h) {
         res.x = x;
         res.y = c;
         res.z = 0.0;
-    } else if h >= 120.0 && h < 180.0 {
+    } else if (120.0..180.0).contains(&h) {
         res.x = 0.0;
         res.y = c;
         res.z = x;
-    } else if h >= 180.0 && h < 240.0 {
+    } else if (180.0..240.0).contains(&h) {
         res.x = 0.0;
         res.y = x;
         res.z = c;
-    } else if h >= 240.0 && h < 300.0 {
+    } else if (240.0..300.0).contains(&h) {
         res.x = x;
         res.y = 0.0;
         res.z = c;
@@ -785,7 +785,7 @@ fn hsv_to_rgb(from: &Vec3) -> Color {
         res.z = x;
     }
 
-    res = res + Vec4::new(m, m, m, 0.0);
+    res += Vec4::new(m, m, m, 0.0);
 
     Color::from(res)
 }
diff --git a/src/styles/units.rs b/src/styles/units.rs
index 01c5631..eab69b5 100644
--- a/src/styles/units.rs
+++ b/src/styles/units.rs
@@ -17,9 +17,9 @@ impl Default for LayoutType {
     }
 }
 
-impl Into<morphorm::LayoutType> for LayoutType {
-    fn into(self) -> morphorm::LayoutType {
-        match self {
+impl From<LayoutType> for morphorm::LayoutType {
+    fn from(val: LayoutType) -> Self {
+        match val {
             LayoutType::Column => morphorm::LayoutType::Column,
             LayoutType::Row => morphorm::LayoutType::Row,
             LayoutType::Grid => morphorm::LayoutType::Grid,
@@ -42,11 +42,11 @@ impl Default for KPositionType {
     }
 }
 
-impl Into<morphorm::PositionType> for KPositionType {
-    fn into(self) -> morphorm::PositionType {
-        match self {
-            Self::ParentDirected => morphorm::PositionType::ParentDirected,
-            Self::SelfDirected => morphorm::PositionType::SelfDirected,
+impl From<KPositionType> for morphorm::PositionType {
+    fn from(val: KPositionType) -> Self {
+        match val {
+            KPositionType::ParentDirected => morphorm::PositionType::ParentDirected,
+            KPositionType::SelfDirected => morphorm::PositionType::SelfDirected,
         }
     }
 }
@@ -70,13 +70,13 @@ impl Default for Units {
     }
 }
 
-impl Into<morphorm::Units> for Units {
-    fn into(self) -> morphorm::Units {
-        match self {
-            Self::Pixels(value) => morphorm::Units::Pixels(value),
-            Self::Percentage(value) => morphorm::Units::Percentage(value),
-            Self::Stretch(value) => morphorm::Units::Stretch(value),
-            Self::Auto => morphorm::Units::Auto,
+impl From<Units> for morphorm::Units {
+    fn from(val: Units) -> Self {
+        match val {
+            Units::Pixels(value) => morphorm::Units::Pixels(value),
+            Units::Percentage(value) => morphorm::Units::Percentage(value),
+            Units::Stretch(value) => morphorm::Units::Stretch(value),
+            Units::Auto => morphorm::Units::Auto,
         }
     }
 }
@@ -85,42 +85,30 @@ impl Units {
     /// Converts the units to an f32 value
     pub fn value_or(&self, parent_value: f32, auto: f32) -> f32 {
         match self {
-            &Units::Pixels(pixels) => pixels,
-            &Units::Percentage(percentage) => (percentage / 100.0) * parent_value,
-            &Units::Stretch(_) => auto,
-            &Units::Auto => auto,
+            Units::Pixels(pixels) => *pixels,
+            Units::Percentage(percentage) => (percentage / 100.0) * parent_value,
+            Units::Stretch(_) => auto,
+            Units::Auto => auto,
         }
     }
 
     /// Returns true if the value is in pixels
     pub fn is_pixels(&self) -> bool {
-        match self {
-            Units::Pixels(_) => true,
-            _ => false,
-        }
+        matches!(self, Units::Pixels(_))
     }
 
     /// Returns true if the value is a percentage
     pub fn is_percentage(&self) -> bool {
-        match self {
-            Units::Percentage(_) => true,
-            _ => false,
-        }
+        matches!(self, Units::Percentage(_))
     }
 
     /// Returns true if the value is a stretch factor
     pub fn is_stretch(&self) -> bool {
-        match self {
-            Units::Stretch(_) => true,
-            _ => false,
-        }
+        matches!(self, Units::Stretch(_))
     }
 
     /// Returns true if the value is auto
     pub fn is_auto(&self) -> bool {
-        match self {
-            Units::Auto => true,
-            _ => false,
-        }
+        matches!(self, Units::Auto)
     }
 }
diff --git a/src/tree.rs b/src/tree.rs
index 757c531..c21dc81 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -258,9 +258,8 @@ impl Tree {
         let children_b = other_tree.children.get(&root_node);
 
         // Handle both easy cases first..
-        if children_a.is_some() && children_b.is_none() {
+        if let (Some(children_a), None) = (children_a, children_b) {
             return children_a
-                .unwrap()
                 .iter()
                 .enumerate()
                 .map(|(child_id, child_node)| {
@@ -268,9 +267,8 @@ impl Tree {
                 })
                 .collect::<Vec<_>>()
                 .into();
-        } else if children_a.is_none() && children_b.is_some() {
+        } else if let (None, Some(children_b)) = (children_a, children_b) {
             return children_b
-                .unwrap()
                 .iter()
                 .enumerate()
                 .map(|(child_id, child_node)| {
@@ -362,9 +360,7 @@ impl Tree {
 
                 let parent_a = self.parent(children_a.get(*id).unwrap().1);
                 let parent_b = self.parent(*node);
-                let definitely_moved = if parent_a.is_some() && parent_b.is_some() {
-                    let parent_a = parent_a.unwrap();
-                    let parent_b = parent_b.unwrap();
+                let definitely_moved = if let (Some(parent_a), Some(parent_b)) = (parent_a, parent_b) {
                     parent_a != parent_b
                         || (parent_a == parent_b
                             && *node != children_a.get(*id).unwrap().1
@@ -485,9 +481,7 @@ impl Tree {
 
                 let parent_a = self.parent(tree1.get(*id).unwrap().1);
                 let parent_b = self.parent(*node);
-                let definitely_moved = if parent_a.is_some() && parent_b.is_some() {
-                    let parent_a = parent_a.unwrap();
-                    let parent_b = parent_b.unwrap();
+                let definitely_moved = if let (Some(parent_a), Some(parent_b)) = (parent_a, parent_b) {
                     parent_a != parent_b
                         || (parent_a == parent_b
                             && *node != tree1.get(*id).unwrap().1
@@ -527,19 +521,18 @@ impl Tree {
         if children_a.is_none() && children_b.is_none() {
             // Nothing to do.
             return;
-        } else if children_a.is_none() && children_b.is_some() {
+        } else if let (None, Some(children_b)) = (children_a.as_ref(), children_b) {
             // Simple case of moving all children over to A.
-            self.children.insert(root_node, children_b.unwrap().clone());
+            self.children.insert(root_node, children_b.clone());
             for (parent, children) in self.children.iter() {
                 for child in children.iter() {
                     self.parents.insert(*child, *parent);
                 }
             }
             return;
-        } else if children_a.is_some() && children_b.is_none() {
+        } else if let (Some(children_a), None) = (children_a.as_ref(), children_b) {
             // Case for erasing all
             if has_changes {
-                let children_a = children_a.unwrap();
                 for child in children_a.iter() {
                     self.parents.remove(child);
                 }
@@ -644,7 +637,7 @@ impl Tree {
             for child in children.iter() {
                 println!("    [{}]", child.0.index());
             }
-            println!("");
+            println!();
         }
     }
 
diff --git a/src/widget.rs b/src/widget.rs
index 0b94249..0161fdf 100644
--- a/src/widget.rs
+++ b/src/widget.rs
@@ -164,9 +164,7 @@ impl<'w, 's, Props: PartialEq + Component, State: PartialEq + Component>
         }
 
         // Check state
-        if current_state_entity.is_some() && previous_state_entity.is_some() {
-            let previous_state_entity = previous_state_entity.unwrap();
-            let current_state_entity = current_state_entity.unwrap();
+        if let (Some(current_state_entity), Some(previous_state_entity)) = (current_state_entity, previous_state_entity) {
             if let (Ok(state), Ok(previous_state)) = (
                 self.state_query.get(current_state_entity),
                 self.state_query.get(previous_state_entity),
diff --git a/src/widgets/accordion/context.rs b/src/widgets/accordion/context.rs
index 9b9ef01..b91150d 100644
--- a/src/widgets/accordion/context.rs
+++ b/src/widgets/accordion/context.rs
@@ -16,7 +16,7 @@ pub struct AccordionContext {
 
 impl AccordionContext {
     pub fn is_open(&self, index: usize) -> bool {
-        self.accordions.get(&index).map(|v| *v).unwrap_or(false)
+        self.accordions.get(&index).copied().unwrap_or(false)
     }
 
     pub fn toggle_current(&mut self, index: usize) {
@@ -80,8 +80,10 @@ pub fn render(
         {
             context_entity
         } else {
-            let mut accordion_context = AccordionContext::default();
-            accordion_context.allow_one = accordion.allow_only_one;
+            let mut accordion_context = AccordionContext {
+                allow_one: accordion.allow_only_one,
+                ..AccordionContext::default()
+            };
             if let Some(default_open) = accordion.default_open {
                 accordion_context.toggle_current(default_open);
             }
diff --git a/src/widgets/accordion/summary.rs b/src/widgets/accordion/summary.rs
index 662f9c1..1f40d6a 100644
--- a/src/widgets/accordion/summary.rs
+++ b/src/widgets/accordion/summary.rs
@@ -81,11 +81,8 @@ pub fn render(
                         if let Ok(mut context) = query.get_mut(context_entity) {
                             event.stop_propagation();
                             event.prevent_default();
-                            match event.event_type {
-                                EventType::Click(..) => {
-                                    context.toggle_current(current_index);
-                                }
-                                _ => {}
+                            if let EventType::Click(..) = event.event_type {
+                                context.toggle_current(current_index);
                             }
                         }
                     },
diff --git a/src/widgets/button.rs b/src/widgets/button.rs
index 7597688..adf34cb 100644
--- a/src/widgets/button.rs
+++ b/src/widgets/button.rs
@@ -80,7 +80,7 @@ pub fn button_render(
                     },
                     border: Edge::all(2.0).into(),
                     border_radius: StyleProp::Value(Corner::all(10.0)),
-                    font_size: StyleProp::Value(font_size).into(),
+                    font_size: StyleProp::Value(font_size),
                     height: StyleProp::Value(height),
                     width: Units::Stretch(1.0).into(),
                     cursor: StyleProp::Value(KCursorIcon(CursorIcon::Hand)),
diff --git a/src/widgets/icons/mod.rs b/src/widgets/icons/mod.rs
index a1ae188..6174ddd 100644
--- a/src/widgets/icons/mod.rs
+++ b/src/widgets/icons/mod.rs
@@ -17,8 +17,8 @@ impl Plugin for IconsPlugin {
     fn build(&self, app: &mut bevy::prelude::App) {
         let expand_less_bytes = include_bytes!("expand_less.svg");
         let expand_more_bytes = include_bytes!("expand_more.svg");
-        let mut expand_less = Svg::from_bytes(expand_less_bytes, &Path::new("")).unwrap();
-        let mut expand_more = Svg::from_bytes(expand_more_bytes, &Path::new("")).unwrap();
+        let mut expand_less = Svg::from_bytes(expand_less_bytes, Path::new("")).unwrap();
+        let mut expand_more = Svg::from_bytes(expand_more_bytes, Path::new("")).unwrap();
 
         let mut meshes = app.world.get_resource_mut::<Assets<Mesh>>().unwrap();
         expand_less.mesh = meshes.add(expand_less.tessellate());
diff --git a/src/widgets/modal.rs b/src/widgets/modal.rs
index b3ae104..73b900c 100644
--- a/src/widgets/modal.rs
+++ b/src/widgets/modal.rs
@@ -102,7 +102,7 @@ pub fn render(
             },
             style_b: KStyle {
                 opacity: 1.0.into(),
-                ..styles.clone()
+                ..styles
             },
             autoplay: false,
         };
@@ -150,7 +150,7 @@ pub fn render(
                             render_command: RenderCommand::Quad.into(),
                             position_type: KPositionType::SelfDirected.into(),
                             ..Default::default()
-                        }.with_style(modal_styles).into()}
+                        }.with_style(modal_styles)}
                     >
                         <BackgroundBundle
                             styles={KStyle {
diff --git a/src/widgets/scroll/scroll_bar.rs b/src/widgets/scroll/scroll_bar.rs
index d3387f5..bda78cc 100644
--- a/src/widgets/scroll/scroll_bar.rs
+++ b/src/widgets/scroll/scroll_bar.rs
@@ -144,19 +144,16 @@ pub fn scroll_bar_render(
                         });
 
                 let mut border_color = thumb_color;
-                match &mut border_color {
-                    Color::Rgba {
-                        red,
-                        green,
-                        blue,
-                        alpha,
-                    } => {
-                        *alpha = (*alpha - 0.2).max(0.0);
-                        *red = (*red + 0.1).min(1.0);
-                        *green = (*green + 0.1).min(1.0);
-                        *blue = (*blue + 0.1).min(1.0);
-                    }
-                    _ => {}
+                if let Color::Rgba {
+                    red,
+                    green,
+                    blue,
+                    alpha,
+                } = &mut border_color {
+                    *alpha = (*alpha - 0.2).max(0.0);
+                    *red = (*red + 0.1).min(1.0);
+                    *green = (*green + 0.1).min(1.0);
+                    *blue = (*blue + 0.1).min(1.0);
                 }
 
                 let mut thumb_style = KStyle::default()
diff --git a/src/widgets/scroll/scroll_box.rs b/src/widgets/scroll/scroll_box.rs
index b05c85a..6abab73 100644
--- a/src/widgets/scroll/scroll_box.rs
+++ b/src/widgets/scroll/scroll_box.rs
@@ -185,31 +185,28 @@ pub fn scroll_box_render(
                           mut event: ResMut<KEvent>,
                           mut query: Query<&mut ScrollContext>| {
                         if let Ok(mut scroll_context) = query.get_mut(context_entity) {
-                            match event.event_type {
-                                EventType::Scroll(evt) => {
-                                    match evt.delta {
-                                        ScrollUnit::Line { x, y } => {
-                                            if !disable_horizontal {
-                                                scroll_context
-                                                    .set_scroll_x(scroll_x - x * scroll_line);
-                                            }
-                                            if !disable_vertical {
-                                                scroll_context
-                                                    .set_scroll_y(scroll_y + y * scroll_line);
-                                            }
+                            if let EventType::Scroll(evt) = event.event_type {
+                                match evt.delta {
+                                    ScrollUnit::Line { x, y } => {
+                                        if !disable_horizontal {
+                                            scroll_context
+                                                .set_scroll_x(scroll_x - x * scroll_line);
                                         }
-                                        ScrollUnit::Pixel { x, y } => {
-                                            if !disable_horizontal {
-                                                scroll_context.set_scroll_x(scroll_x - x);
-                                            }
-                                            if !disable_vertical {
-                                                scroll_context.set_scroll_y(scroll_y + y);
-                                            }
+                                        if !disable_vertical {
+                                            scroll_context
+                                                .set_scroll_y(scroll_y + y * scroll_line);
+                                        }
+                                    }
+                                    ScrollUnit::Pixel { x, y } => {
+                                        if !disable_horizontal {
+                                            scroll_context.set_scroll_x(scroll_x - x);
+                                        }
+                                        if !disable_vertical {
+                                            scroll_context.set_scroll_y(scroll_y + y);
                                         }
                                     }
-                                    event.stop_propagation();
                                 }
-                                _ => {}
+                                event.stop_propagation();
                             }
                         }
                     },
diff --git a/src/widgets/text_box.rs b/src/widgets/text_box.rs
index 667a7ce..00ab963 100644
--- a/src/widgets/text_box.rs
+++ b/src/widgets/text_box.rs
@@ -403,7 +403,7 @@ fn get_single_grapheme_length(
     font_assets: &Res<Assets<KayakFont>>,
     font_mapping: &FontMapping,
     style_font: &StyleProp<String>,
-    text: &String,
+    text: &str,
 ) -> usize {
     let font_handle = match style_font {
         StyleProp::Value(font) => font_mapping.get_handle(font.clone()).unwrap(),
@@ -411,7 +411,7 @@ fn get_single_grapheme_length(
     };
 
     if let Some(font) = font_assets.get(&font_handle) {
-        let graphemes = font.get_graphemes(&text);
+        let graphemes = font.get_graphemes(text);
         return graphemes[0].len();
     }
 
-- 
GitLab