From 21d10a15ee4ef567af10feefba917a351a22a9b7 Mon Sep 17 00:00:00 2001 From: Nova Date: Tue, 20 Aug 2024 16:59:37 -0400 Subject: [PATCH] clippy: cleanup --- src/nodes/input/hand.rs | 3 +++ src/objects/input/mouse_pointer.rs | 2 +- src/wayland/utils.rs | 12 ++---------- src/wayland/xdg_shell.rs | 12 ++++-------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/nodes/input/hand.rs b/src/nodes/input/hand.rs index 789d2e1..8512583 100644 --- a/src/nodes/input/hand.rs +++ b/src/nodes/input/hand.rs @@ -14,6 +14,7 @@ impl Default for Joint { } } } +#[allow(clippy::derivable_impls)] impl Default for Finger { fn default() -> Self { Finger { @@ -25,6 +26,7 @@ impl Default for Finger { } } } +#[allow(clippy::derivable_impls)] impl Default for Thumb { fn default() -> Self { Thumb { @@ -35,6 +37,7 @@ impl Default for Thumb { } } } +#[allow(clippy::derivable_impls)] impl Default for Hand { fn default() -> Self { Hand { diff --git a/src/objects/input/mouse_pointer.rs b/src/objects/input/mouse_pointer.rs index 1a2fe39..2e97a50 100644 --- a/src/objects/input/mouse_pointer.rs +++ b/src/objects/input/mouse_pointer.rs @@ -140,7 +140,7 @@ impl MousePointer { }); let valid = result.deepest_point_distance > 0.0 && result.min_distance.is_sign_negative(); - valid.then(|| result.deepest_point_distance) + valid.then_some(result.deepest_point_distance) }; self.capture_manager.update_capture(&self.pointer); diff --git a/src/wayland/utils.rs b/src/wayland/utils.rs index b6dc842..3625085 100644 --- a/src/wayland/utils.rs +++ b/src/wayland/utils.rs @@ -35,20 +35,12 @@ impl WlSurfaceExt for WlSurface { } fn get_current_surface_state(&self) -> SurfaceCachedState { compositor::with_states(self, |states| { - states - .cached_state - .get::() - .current() - .clone() + *states.cached_state.get::().current() }) } fn get_pending_surface_state(&self) -> SurfaceCachedState { compositor::with_states(self, |states| { - states - .cached_state - .get::() - .pending() - .clone() + *states.cached_state.get::().pending() }) } fn get_size(&self) -> Option> { diff --git a/src/wayland/xdg_shell.rs b/src/wayland/xdg_shell.rs index 50db4a0..8d2b83b 100644 --- a/src/wayland/xdg_shell.rs +++ b/src/wayland/xdg_shell.rs @@ -107,14 +107,10 @@ impl XdgShellHandler for WaylandState { .wl_surface() .max_size() .map(|s| Vector2::from([s.x as f32, s.y as f32])), - logical_rectangle: toplevel - .wl_surface() - .get_geometry() - .map(|r| r.into()) - .unwrap_or(Geometry { - origin: [0; 2].into(), - size: initial_size, - }), + logical_rectangle: toplevel.wl_surface().get_geometry().unwrap_or(Geometry { + origin: [0; 2].into(), + size: initial_size, + }), }; toplevel .wl_surface()