diff --git a/src/app.rs b/src/app.rs index 4157a70..e259dc2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1401,7 +1401,7 @@ impl App { // Manually rescan any trash tabs after any operation is completed commands.push(self.rescan_trash()); - return Task::batch(commands); + Task::batch(commands) } fn handle_operation_errors(&mut self, errors: Vec<(u64, OperationError)>) -> Task { @@ -1446,7 +1446,7 @@ impl App { } // Manually rescan any trash tabs after any operation is completed tasks.push(self.rescan_trash()); - return Task::batch(tasks); + Task::batch(tasks) } fn remove_window(&mut self, id: &window::Id) { @@ -5661,7 +5661,7 @@ impl Application for App { } DialogPage::FailedOperations(ids) => { let errors: Vec = ids - .into_iter() + .iter() .filter_map(|id| match self.failed_operations.get(id) { Some((operation, _, err)) => Some(format!("{operation:#?}\n{err}")), _ => None, diff --git a/src/clipboard.rs b/src/clipboard.rs index 5892071..7e21276 100644 --- a/src/clipboard.rs +++ b/src/clipboard.rs @@ -132,7 +132,7 @@ impl TryFrom<(Vec, String)> for ClipboardPaste { match mime.as_str() { "text/uri-list" => { let text = str::from_utf8(&data)?; - let lines = text.lines(); + let _lines = text.lines(); for line in text.lines() { let url = Url::parse(line)?; diff --git a/src/menu.rs b/src/menu.rs index b9c735a..9f3f158 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -143,12 +143,11 @@ pub fn context_menu<'a>( Some(Location::Trash) | Some(Location::Search(SearchLocation::Trash, ..)) => { selected_trash_only = true } - Some(Location::Path(path)) => { + Some(Location::Path(path)) if selected == 1 - && path.extension().and_then(|s| s.to_str()) == Some("desktop") - { - selected_desktop_entry = Some(&**path); - } + && path.extension().and_then(|s| s.to_str()) == Some("desktop") => + { + selected_desktop_entry = Some(&**path); } _ => (), } diff --git a/src/operation/recursive.rs b/src/operation/recursive.rs index 9a33ebd..047d09b 100644 --- a/src/operation/recursive.rs +++ b/src/operation/recursive.rs @@ -473,12 +473,12 @@ impl Op { progress.total_bytes = metadata.as_ref().map(|m| m.len()); (ctx.on_progress)(self, &progress); - if let Some(metadata) = metadata.as_ref() { - if 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) { - tracing::warn!(?why, "failed to set permissions for {}", self.to.display(),); - } + if let Some(metadata) = metadata.as_ref() + && 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) { + tracing::warn!(?why, "failed to set permissions for {}", self.to.display(),); } } diff --git a/src/tab.rs b/src/tab.rs index 58b2dee..91164c8 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -2991,10 +2991,10 @@ impl Tab { return None; }; let search_items = after - .into_iter() + .iter_mut() .enumerate() .map(|(i, item)| (i + start, item)) - .chain(until.into_iter().enumerate()); + .chain(until.iter_mut().enumerate()); if forward { Self::select_first_prefix_match(prefix_lower, search_items) @@ -3011,7 +3011,7 @@ impl Tab { items: impl Iterator, ) -> Option { for (i, item) in items { - if item.name.to_lowercase().starts_with(&prefix) { + if item.name.to_lowercase().starts_with(prefix) { item.selected = true; return Some(i); } @@ -4332,7 +4332,7 @@ impl Tab { Message::ShiftPermissions(path_mode_opt, shift, bits) => match path_mode_opt { Some((path, mode)) => commands.push(Command::SetPermissions( path, - set_mode_part(mode, shift, bits.try_into().unwrap()), + set_mode_part(mode, shift, bits), )), // Shift permissions on all selected items None => { @@ -4343,13 +4343,9 @@ impl Tab { #[cfg(unix)] if let (Some(path), Some(mode)) = ( item.path_opt(), - item.file_metadata() - .and_then(|metadata| Some(metadata.mode())), + item.file_metadata().map(|metadata| metadata.mode()), ) { - permissions.push(( - path.clone(), - set_mode_part(mode, shift, bits.try_into().unwrap()), - )); + permissions.push((path.clone(), set_mode_part(mode, shift, bits))); } } commands.push(Command::SetMultiplePermissions(permissions)); @@ -6415,33 +6411,31 @@ impl Tab { let mut settings = Vec::new(); // Only allow modifying open-with if all mime types are the same - if mime_types.len() == 1 { - if let Some(mime) = mime_types - .get(0) + if mime_types.len() == 1 + && let Some(mime) = mime_types + .first() .and_then(|(mime, _)| mime.parse::().ok()) - { - if let Some(mime_app_cache) = mime_app_cache_opt { - let mime_apps = mime_app_cache.get(&mime); - if !mime_apps.is_empty() { - let mime_closure = mime.clone(); - settings.push( - widget::settings::item::builder(fl!("open-with")).control( - Element::from( - widget::dropdown( - mime_apps, - mime_apps.iter().position(|x| x.is_default), - move |index| (index, mime_closure.clone()), - ) - .icons(Cow::Borrowed(mime_app_cache.icons(&mime))), - ) - .map(|(index, mime)| { - let mime_app = &mime_apps[index]; - Message::SetOpenWith(mime, mime_app.id.clone()) - }), - ), - ); - } - } + && let Some(mime_app_cache) = mime_app_cache_opt + { + let mime_apps = mime_app_cache.get(&mime); + if !mime_apps.is_empty() { + let mime_closure = mime.clone(); + settings.push( + widget::settings::item::builder(fl!("open-with")).control( + Element::from( + widget::dropdown( + mime_apps, + mime_apps.iter().position(|x| x.is_default), + move |index| (index, mime_closure.clone()), + ) + .icons(Cow::Borrowed(mime_app_cache.icons(&mime))), + ) + .map(|(index, mime)| { + let mime_app = &mime_apps[index]; + Message::SetOpenWith(mime, mime_app.id.clone()) + }), + ), + ); } } diff --git a/src/trash.rs b/src/trash.rs index ce37c83..f46bc48 100644 --- a/src/trash.rs +++ b/src/trash.rs @@ -27,7 +27,7 @@ pub trait TrashExt { Vec::new() } - fn scan_search bool + Sync>(callback: F, regex: &Regex) {} + fn scan_search bool + Sync>(_callback: F, _regex: &Regex) {} fn icon(icon_size: u16) -> widget::icon::Handle { widget::icon::from_name(if Self::is_empty() {