chore(clippy): mime_app, operation, mounter

Fixes Clippy lints for:
* src/mounter/
* src/operation/
* src/mime_app.rs
* src/mouse_area.rs (I missed two of them last time)
This commit is contained in:
Josh Megnauth 2025-01-20 01:48:41 -05:00 • committed by Jeremy Soller
parent 6a6a494012
commit 8ff54d1522
4 changed files with 9 additions and 21 deletions

View file

@ -120,7 +120,7 @@ impl MimeAppCache {
.cache
.entry(mime.clone())
.or_insert_with(|| Vec::with_capacity(1));
if apps.iter().find(|x| x.id == app.id).is_none() {
if !apps.iter().any(|x| x.id == app.id) {
apps.push(MimeApp::from(app));
}
}
@ -191,11 +191,7 @@ impl MimeAppCache {
.cache
.entry(mime.clone())
.or_insert_with(|| Vec::with_capacity(1));
if apps
.iter()
.find(|x| filename_eq(&x.path, filename))
.is_none()
{
if !apps.iter().any(|x| filename_eq(&x.path, filename)) {
if let Some(app) =
all_apps.iter().find(|x| filename_eq(&x.path, filename))
{
@ -263,9 +259,7 @@ impl MimeAppCache {
}
pub fn get(&self, key: &Mime) -> Vec<MimeApp> {
self.cache
.get(&key)
.map_or_else(|| Vec::new(), |x| x.clone())
self.cache.get(key).map_or_else(Vec::new, |x| x.clone())
}
}
@ -292,5 +286,5 @@ pub fn terminal() -> Option<MimeApp> {
}
// Return whatever was the first terminal found
mime_app_cache.terminals.first().map(|x| x.clone())
mime_app_cache.terminals.first().cloned()
}