chore: clippy

This commit is contained in:
Vukašin Vojinović 2026-04-28 14:45:01 +02:00 • committed by Michael Murphy
parent 93e31d433a
commit e91a984da9
6 changed files with 45 additions and 52 deletions

View file

@ -1401,7 +1401,7 @@ impl App {
// Manually rescan any trash tabs after any operation is completed // Manually rescan any trash tabs after any operation is completed
commands.push(self.rescan_trash()); commands.push(self.rescan_trash());
return Task::batch(commands); Task::batch(commands)
} }
fn handle_operation_errors(&mut self, errors: Vec<(u64, OperationError)>) -> Task<Message> { fn handle_operation_errors(&mut self, errors: Vec<(u64, OperationError)>) -> Task<Message> {
@ -1446,7 +1446,7 @@ impl App {
} }
// Manually rescan any trash tabs after any operation is completed // Manually rescan any trash tabs after any operation is completed
tasks.push(self.rescan_trash()); tasks.push(self.rescan_trash());
return Task::batch(tasks); Task::batch(tasks)
} }
fn remove_window(&mut self, id: &window::Id) { fn remove_window(&mut self, id: &window::Id) {
@ -5661,7 +5661,7 @@ impl Application for App {
} }
DialogPage::FailedOperations(ids) => { DialogPage::FailedOperations(ids) => {
let errors: Vec<String> = ids let errors: Vec<String> = ids
.into_iter() .iter()
.filter_map(|id| match self.failed_operations.get(id) { .filter_map(|id| match self.failed_operations.get(id) {
Some((operation, _, err)) => Some(format!("{operation:#?}\n{err}")), Some((operation, _, err)) => Some(format!("{operation:#?}\n{err}")),
_ => None, _ => None,

View file

@ -132,7 +132,7 @@ impl TryFrom<(Vec<u8>, String)> for ClipboardPaste {
match mime.as_str() { match mime.as_str() {
"text/uri-list" => { "text/uri-list" => {
let text = str::from_utf8(&data)?; let text = str::from_utf8(&data)?;
let lines = text.lines(); let _lines = text.lines();
for line in text.lines() { for line in text.lines() {
let url = Url::parse(line)?; let url = Url::parse(line)?;

View file

@ -143,12 +143,11 @@ pub fn context_menu<'a>(
Some(Location::Trash) | Some(Location::Search(SearchLocation::Trash, ..)) => { Some(Location::Trash) | Some(Location::Search(SearchLocation::Trash, ..)) => {
selected_trash_only = true selected_trash_only = true
} }
Some(Location::Path(path)) => { Some(Location::Path(path))
if selected == 1 if selected == 1
&& path.extension().and_then(|s| s.to_str()) == Some("desktop") && path.extension().and_then(|s| s.to_str()) == Some("desktop") =>
{ {
selected_desktop_entry = Some(&**path); selected_desktop_entry = Some(&**path);
}
} }
_ => (), _ => (),
} }

View file

@ -473,12 +473,12 @@ impl Op {
progress.total_bytes = metadata.as_ref().map(|m| m.len()); progress.total_bytes = metadata.as_ref().map(|m| m.len());
(ctx.on_progress)(self, &progress); (ctx.on_progress)(self, &progress);
if let Some(metadata) = metadata.as_ref() { if let Some(metadata) = metadata.as_ref()
if let Err(why) = to_file.set_permissions(metadata.permissions()).await { && let Err(why) = to_file.set_permissions(metadata.permissions()).await
// This error is not propagated upwards as some filesystems do not support setting permissions {
if !matches!(why.kind(), std::io::ErrorKind::Unsupported) { // This error is not propagated upwards as some filesystems do not support setting permissions
tracing::warn!(?why, "failed to set permissions for {}", self.to.display(),); if !matches!(why.kind(), std::io::ErrorKind::Unsupported) {
} tracing::warn!(?why, "failed to set permissions for {}", self.to.display(),);
} }
} }

View file

@ -2991,10 +2991,10 @@ impl Tab {
return None; return None;
}; };
let search_items = after let search_items = after
.into_iter() .iter_mut()
.enumerate() .enumerate()
.map(|(i, item)| (i + start, item)) .map(|(i, item)| (i + start, item))
.chain(until.into_iter().enumerate()); .chain(until.iter_mut().enumerate());
if forward { if forward {
Self::select_first_prefix_match(prefix_lower, search_items) Self::select_first_prefix_match(prefix_lower, search_items)
@ -3011,7 +3011,7 @@ impl Tab {
items: impl Iterator<Item = (usize, &'a mut Item)>, items: impl Iterator<Item = (usize, &'a mut Item)>,
) -> Option<usize> { ) -> Option<usize> {
for (i, item) in items { for (i, item) in items {
if item.name.to_lowercase().starts_with(&prefix) { if item.name.to_lowercase().starts_with(prefix) {
item.selected = true; item.selected = true;
return Some(i); return Some(i);
} }
@ -4332,7 +4332,7 @@ impl Tab {
Message::ShiftPermissions(path_mode_opt, shift, bits) => match path_mode_opt { Message::ShiftPermissions(path_mode_opt, shift, bits) => match path_mode_opt {
Some((path, mode)) => commands.push(Command::SetPermissions( Some((path, mode)) => commands.push(Command::SetPermissions(
path, path,
set_mode_part(mode, shift, bits.try_into().unwrap()), set_mode_part(mode, shift, bits),
)), )),
// Shift permissions on all selected items // Shift permissions on all selected items
None => { None => {
@ -4343,13 +4343,9 @@ impl Tab {
#[cfg(unix)] #[cfg(unix)]
if let (Some(path), Some(mode)) = ( if let (Some(path), Some(mode)) = (
item.path_opt(), item.path_opt(),
item.file_metadata() item.file_metadata().map(|metadata| metadata.mode()),
.and_then(|metadata| Some(metadata.mode())),
) { ) {
permissions.push(( permissions.push((path.clone(), set_mode_part(mode, shift, bits)));
path.clone(),
set_mode_part(mode, shift, bits.try_into().unwrap()),
));
} }
} }
commands.push(Command::SetMultiplePermissions(permissions)); commands.push(Command::SetMultiplePermissions(permissions));
@ -6415,33 +6411,31 @@ impl Tab {
let mut settings = Vec::new(); let mut settings = Vec::new();
// Only allow modifying open-with if all mime types are the same // Only allow modifying open-with if all mime types are the same
if mime_types.len() == 1 { if mime_types.len() == 1
if let Some(mime) = mime_types && let Some(mime) = mime_types
.get(0) .first()
.and_then(|(mime, _)| mime.parse::<Mime>().ok()) .and_then(|(mime, _)| mime.parse::<Mime>().ok())
{ && let Some(mime_app_cache) = mime_app_cache_opt
if let Some(mime_app_cache) = mime_app_cache_opt { {
let mime_apps = mime_app_cache.get(&mime); let mime_apps = mime_app_cache.get(&mime);
if !mime_apps.is_empty() { if !mime_apps.is_empty() {
let mime_closure = mime.clone(); let mime_closure = mime.clone();
settings.push( settings.push(
widget::settings::item::builder(fl!("open-with")).control( widget::settings::item::builder(fl!("open-with")).control(
Element::from( Element::from(
widget::dropdown( widget::dropdown(
mime_apps, mime_apps,
mime_apps.iter().position(|x| x.is_default), mime_apps.iter().position(|x| x.is_default),
move |index| (index, mime_closure.clone()), move |index| (index, mime_closure.clone()),
) )
.icons(Cow::Borrowed(mime_app_cache.icons(&mime))), .icons(Cow::Borrowed(mime_app_cache.icons(&mime))),
) )
.map(|(index, mime)| { .map(|(index, mime)| {
let mime_app = &mime_apps[index]; let mime_app = &mime_apps[index];
Message::SetOpenWith(mime, mime_app.id.clone()) Message::SetOpenWith(mime, mime_app.id.clone())
}), }),
), ),
); );
}
}
} }
} }

View file

@ -27,7 +27,7 @@ pub trait TrashExt {
Vec::new() Vec::new()
} }
fn scan_search<F: Fn(SearchItem) -> bool + Sync>(callback: F, regex: &Regex) {} fn scan_search<F: Fn(SearchItem) -> bool + Sync>(_callback: F, _regex: &Regex) {}
fn icon(icon_size: u16) -> widget::icon::Handle { fn icon(icon_size: u16) -> widget::icon::Handle {
widget::icon::from_name(if Self::is_empty() { widget::icon::from_name(if Self::is_empty() {