diff --git a/src/core/resource.rs b/src/core/resource.rs index f69032a..0d9c588 100644 --- a/src/core/resource.rs +++ b/src/core/resource.rs @@ -3,11 +3,11 @@ use std::path::PathBuf; pub type ResourceID = Box; pub trait ResourceIDTrait { - fn get_file(&self, prefixes: &Vec) -> Option; + fn get_file(&self, prefixes: &[PathBuf]) -> Option; } impl ResourceIDTrait for PathBuf { - fn get_file(&self, _prefixes: &Vec) -> Option { + fn get_file(&self, _prefixes: &[PathBuf]) -> Option { if self.is_absolute() && self.as_path().exists() { Some(self.clone()) } else { @@ -22,7 +22,7 @@ pub struct NamespacedResourceID { } impl ResourceIDTrait for NamespacedResourceID { - fn get_file(&self, prefixes: &Vec) -> Option { + fn get_file(&self, prefixes: &[PathBuf]) -> Option { for prefix in prefixes { let mut path = prefix.clone(); path.push(self.namespace.clone()); diff --git a/src/nodes/core.rs b/src/nodes/core.rs index f638627..b7cf0a9 100644 --- a/src/nodes/core.rs +++ b/src/nodes/core.rs @@ -160,8 +160,7 @@ impl Node { } } pub fn send_remote_signal(&self, method: &str, data: &[u8]) -> Result<()> { - let _ = self - .aliases + self.aliases .get_valid_contents() .iter() .filter(|alias| alias.remote_signals.iter().any(|e| e == &method)) diff --git a/src/nodes/data.rs b/src/nodes/data.rs index bd64e24..3c5b890 100644 --- a/src/nodes/data.rs +++ b/src/nodes/data.rs @@ -158,7 +158,7 @@ pub struct PulseReceiver { pub mask: Mutex, field: Weak, } -impl<'a> PulseReceiver { +impl PulseReceiver { pub fn add_to(node: &Arc, field: Arc) -> Result<()> { ensure!( node.spatial.get().is_some(), diff --git a/src/nodes/model.rs b/src/nodes/model.rs index d313984..68a48ab 100644 --- a/src/nodes/model.rs +++ b/src/nodes/model.rs @@ -62,7 +62,7 @@ impl Model { model_arc .resource_id .get_file(&node.get_client().base_resource_prefixes.lock().clone()) - .ok_or(anyhow!("Resource not found"))?, + .ok_or_else(|| anyhow!("Resource not found"))?, ); let _ = node.model.set(model_arc.clone()); Ok(model_arc) @@ -75,7 +75,7 @@ impl Model { self.pending_model_path .get() .and_then(|path| SKModel::from_file(sk, path.as_path(), None)) - .map(|model| SendWrapper::new(model)) + .map(SendWrapper::new) .ok_or(Error) }) .ok(); diff --git a/src/nodes/root.rs b/src/nodes/root.rs index 7912330..b051683 100644 --- a/src/nodes/root.rs +++ b/src/nodes/root.rs @@ -56,7 +56,7 @@ impl Root { *calling_client.base_resource_prefixes.lock() = flex_vec .iter() .filter_map(|prefix| prefix.get_str().ok()) - .map(|prefix| PathBuf::from(prefix)) + .map(PathBuf::from) .filter(|prefix| prefix.is_absolute()) .collect(); Ok(()) diff --git a/src/wayland/compositor.rs b/src/wayland/compositor.rs index 1170827..f39aa6d 100644 --- a/src/wayland/compositor.rs +++ b/src/wayland/compositor.rs @@ -29,7 +29,7 @@ impl CompositorHandler for WaylandState { .borrow() .texture(&self.renderer) .cloned() - .map(|renderer| SendWrapper::new(renderer)), + .map(SendWrapper::new), ); } } diff --git a/src/wayland/xdg_shell.rs b/src/wayland/xdg_shell.rs index a97fd01..96cf968 100644 --- a/src/wayland/xdg_shell.rs +++ b/src/wayland/xdg_shell.rs @@ -28,7 +28,7 @@ impl XdgShellHandler for WaylandState { surface.send_configure(); compositor::with_states(surface.wl_surface(), |data| { - data.data_map.insert_if_missing(|| CoreSurface::new()); + data.data_map.insert_if_missing(CoreSurface::new); }); } @@ -43,7 +43,7 @@ impl XdgShellHandler for WaylandState { let _ = surface.send_configure(); compositor::with_states(surface.wl_surface(), |data| { - data.data_map.insert_if_missing(|| CoreSurface::new()); + data.data_map.insert_if_missing(CoreSurface::new); }); }