fix(clippy): silenced but i owe it my life

This commit is contained in:
Nova
2022-08-22 10:21:34 -04:00
parent a8bbfbafdf
commit 4335e2b216
7 changed files with 11 additions and 12 deletions

View File

@@ -3,11 +3,11 @@ use std::path::PathBuf;
pub type ResourceID = Box<dyn ResourceIDTrait + Send + Sync>;
pub trait ResourceIDTrait {
fn get_file(&self, prefixes: &Vec<PathBuf>) -> Option<PathBuf>;
fn get_file(&self, prefixes: &[PathBuf]) -> Option<PathBuf>;
}
impl ResourceIDTrait for PathBuf {
fn get_file(&self, _prefixes: &Vec<PathBuf>) -> Option<PathBuf> {
fn get_file(&self, _prefixes: &[PathBuf]) -> Option<PathBuf> {
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<PathBuf>) -> Option<PathBuf> {
fn get_file(&self, prefixes: &[PathBuf]) -> Option<PathBuf> {
for prefix in prefixes {
let mut path = prefix.clone();
path.push(self.namespace.clone());

View File

@@ -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))

View File

@@ -158,7 +158,7 @@ pub struct PulseReceiver {
pub mask: Mutex<Mask>,
field: Weak<Field>,
}
impl<'a> PulseReceiver {
impl PulseReceiver {
pub fn add_to(node: &Arc<Node>, field: Arc<Field>) -> Result<()> {
ensure!(
node.spatial.get().is_some(),

View File

@@ -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();

View File

@@ -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(())

View File

@@ -29,7 +29,7 @@ impl CompositorHandler for WaylandState {
.borrow()
.texture(&self.renderer)
.cloned()
.map(|renderer| SendWrapper::new(renderer)),
.map(SendWrapper::new),
);
}
}

View File

@@ -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);
});
}