From 6e2eafe16c03b3f26fa0c0afe22e05fac1cbbdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= <150025636+git-f0x@users.noreply.github.com> Date: Sat, 14 Mar 2026 23:32:47 +0100 Subject: [PATCH] chore: clippy --- src/app.rs | 8 +++--- src/dialog.rs | 4 +-- src/mouse_area.rs | 2 +- src/operation/mod.rs | 11 ++++---- src/tab.rs | 60 +++++++++++++++++++------------------------- 5 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/app.rs b/src/app.rs index 4e20f48..a8d4c53 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1452,7 +1452,7 @@ impl App { }; search_location.map(|search_location| { - return ( + ( Location::Search( search_location, term, @@ -1460,7 +1460,7 @@ impl App { Instant::now(), ), true, - ); + ) }) } None => match &tab.location { @@ -6194,11 +6194,11 @@ impl Application for App { .button_height(32) .button_spacing(space_xxs) .enable_tab_drag(String::from("x-cosmic-files/tab-dnd")) - .on_reorder(move |event| Message::ReorderTab(event)) + .on_reorder(Message::ReorderTab) .tab_drag_threshold(25.) .on_activate(Message::TabActivate) .on_close(|entity| Message::TabClose(Some(entity))) - .on_dnd_enter(|entity, mimes| Message::DndEnterTab(entity, mimes)) + .on_dnd_enter(Message::DndEnterTab) .on_dnd_leave(|_| Message::DndExitTab) .on_dnd_drop(|entity, data, action| { Message::DndDropTab(entity, data, action) diff --git a/src/dialog.rs b/src/dialog.rs index 6f0e5cb..bcfac6c 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -798,7 +798,7 @@ impl App { }; search_location.map(|search_location| { - return ( + ( Location::Search( search_location, term, @@ -806,7 +806,7 @@ impl App { Instant::now(), ), true, - ); + ) }) } None => match &self.tab.location { diff --git a/src/mouse_area.rs b/src/mouse_area.rs index dea4b25..56b86bb 100644 --- a/src/mouse_area.rs +++ b/src/mouse_area.rs @@ -395,7 +395,7 @@ where update( self, - &event, + event, layout, cursor, shell, diff --git a/src/operation/mod.rs b/src/operation/mod.rs index 3aad6fc..fa1aba1 100644 --- a/src/operation/mod.rs +++ b/src/operation/mod.rs @@ -762,13 +762,12 @@ impl Operation { OperationError::from_err(e, &controller) })?; - if let Ok(modified) = metadata.modified() { - if let Some(last_modified) = + if let Ok(modified) = metadata.modified() + && let Some(last_modified) = archive::system_time_to_zip_date_time(modified) - { - zip_options = - zip_options.last_modified_time(last_modified); - } + { + zip_options = + zip_options.last_modified_time(last_modified); } #[cfg(unix)] diff --git a/src/tab.rs b/src/tab.rs index 9f05c3f..1e0d3ce 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -8,9 +8,8 @@ use cosmic::{ graphics, text::{self, Paragraph}, }, - alignment::{Horizontal, Vertical}, + alignment::Vertical, clipboard::dnd::DndAction, - event, futures::{self, SinkExt}, keyboard::Modifiers, padding, stream, @@ -24,7 +23,7 @@ use cosmic::{ iced_core::{mouse::ScrollDelta, widget::tree}, theme, widget::{ - self, DndDestination, DndSource, Id, RcElementWrapper, Space, Widget, + self, DndDestination, DndSource, Id, RcElementWrapper, Widget, menu::{action::MenuAction, key_bind::KeyBind}, space, }, @@ -32,15 +31,13 @@ use cosmic::{ use i18n_embed::LanguageLoader; use icu::{ datetime::{ - DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, - input::{Date, DateTime, Time}, + DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, input::DateTime, options::TimePrecision, }, locale::preferences::extensions::unicode::keywords::HourCycle, }; -use image::{DynamicImage, ImageDecoder, ImageReader}; +use image::{DynamicImage, ImageReader}; use jiff_icu::ConvertFrom; -use jxl_oxide::integration::JxlDecoder; use mime_guess::{Mime, mime}; use regex::Regex; use rustc_hash::FxHashMap; @@ -1284,10 +1281,8 @@ pub mod trash_helpers { log::warn!("failed to get metadata for trash item {entry:?}: {err}") }) { let name = entry.name.to_string_lossy(); - if regex.is_match(&name) { - if !callback(SearchItem::Trash(entry, metadata)) { - break; - } + if regex.is_match(&name) && !callback(SearchItem::Trash(entry, metadata)) { + break; } } } @@ -2601,13 +2596,12 @@ impl Item { } column = column.push(details); - if let Some(path) = self.path_opt() { - if self.selected { - column = column.push( - widget::button::standard(fl!("open")) - .on_press(Message::Open(Some(path.clone()))), - ); - } + if let Some(path) = self.path_opt() + && self.selected + { + column = column.push( + widget::button::standard(fl!("open")).on_press(Message::Open(Some(path.clone()))), + ); } if !settings.is_empty() { @@ -5917,12 +5911,13 @@ impl Tab { }; let button_row = button(row.into()); - let button_row: Element<_> = - if item.metadata.is_dir() && item.location_opt.is_some() { - self.dnd_dest(item.location_opt.as_ref().unwrap(), button_row) - } else { - button_row.into() - }; + let button_row: Element<_> = if item.metadata.is_dir() + && let Some(location) = item.location_opt.as_ref() + { + self.dnd_dest(location, button_row) + } else { + button_row.into() + }; if item.selected || !drag_items.is_empty() { let dnd_row = if !item.selected { @@ -6289,8 +6284,7 @@ impl Tab { if item.selected { item.location_opt .as_ref() - .map(Location::path_opt) - .flatten() + .and_then(Location::path_opt) .is_some() } else { false @@ -6688,17 +6682,15 @@ impl Tab { // Don't send if the result is too old if let Some(last_modified) = *last_modified_opt.read().unwrap() - { - if let SearchItem::Path(_, _, ref metadata) = + && let SearchItem::Path(_, _, ref metadata) = search_item - { - if let Ok(modified) = metadata.modified() { - if modified < last_modified { - return true; - } - } else { + { + if let Ok(modified) = metadata.modified() { + if modified < last_modified { return true; } + } else { + return true; } }