From 9dd8580271ba917eff7809df7c31f4f962f8ffa4 Mon Sep 17 00:00:00 2001 From: Nova Date: Sun, 25 Sep 2022 03:44:43 -0400 Subject: [PATCH] fix: clippy --- src/nodes/drawable/model.rs | 4 +++- src/wayland/panel_item.rs | 4 ++-- src/wayland/state.rs | 2 +- src/wayland/xdg_shell.rs | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/nodes/drawable/model.rs b/src/nodes/drawable/model.rs index ce22bd7..02e9b72 100644 --- a/src/nodes/drawable/model.rs +++ b/src/nodes/drawable/model.rs @@ -112,7 +112,9 @@ impl Drawable for Model { .get_or_try_init(|| { self.pending_model_path .get() - .and_then(|path| SKModel::from_file(sk, path.as_path(), None).clone()) + .and_then(|path| SKModel::from_file(sk, path.as_path(), None)) + .as_ref() + .cloned() .map(SendWrapper::new) .ok_or(Error) }) diff --git a/src/wayland/panel_item.rs b/src/wayland/panel_item.rs index 7c359dd..c68964b 100644 --- a/src/wayland/panel_item.rs +++ b/src/wayland/panel_item.rs @@ -177,7 +177,7 @@ impl PanelItem { } } - pub fn if_mapped(core_surface: &Arc, surface_data: &SurfaceData) { + pub fn if_mapped(_core_surface: &Arc, surface_data: &SurfaceData) { if let Some(panel_node) = surface_data.data_map.get::>() { let panel_item = PanelItem::from_node(panel_node); @@ -473,7 +473,7 @@ impl PanelItem { surfaces .iter() .find(|surf| surf.wl_surface().clone() == core_surface.wl_surface()) - .map(|surf| surf.clone()) + .cloned() }); if let Some(toplevel_surface) = toplevel_surface { diff --git a/src/wayland/state.rs b/src/wayland/state.rs index 53be395..c2defd4 100644 --- a/src/wayland/state.rs +++ b/src/wayland/state.rs @@ -31,7 +31,7 @@ use std::sync::{Arc, Weak}; pub struct ClientState; impl ClientData for ClientState { fn initialized(&self, client_id: ClientId) { - println!("Wayland client {:?} connected", client_id.clone()); + println!("Wayland client {:?} connected", client_id); } fn disconnected(&self, client_id: ClientId, reason: DisconnectReason) { diff --git a/src/wayland/xdg_shell.rs b/src/wayland/xdg_shell.rs index 45a1c21..61e2b56 100644 --- a/src/wayland/xdg_shell.rs +++ b/src/wayland/xdg_shell.rs @@ -45,13 +45,13 @@ impl XdgShellHandler for WaylandState { if let Some(panel_node) = data.data_map.get::>() { if let Some(core_surface) = data.data_map.get::>() { let panel_item = PanelItem::from_node(panel_node); - if core_surface + let has_data = core_surface .with_data(|data| { data.size.x = size.w as u32; data.size.y = size.h as u32; }) - .is_some() - { + .is_some(); + if has_data { panel_item.resize(); } }