chore: clippy

This commit is contained in:
Vukašin Vojinović 2026-03-14 23:32:47 +01:00 committed by Jacob Kauffmann
parent 3b1bc4430b
commit 6e2eafe16c
5 changed files with 38 additions and 47 deletions

View file

@ -1452,7 +1452,7 @@ impl App {
}; };
search_location.map(|search_location| { search_location.map(|search_location| {
return ( (
Location::Search( Location::Search(
search_location, search_location,
term, term,
@ -1460,7 +1460,7 @@ impl App {
Instant::now(), Instant::now(),
), ),
true, true,
); )
}) })
} }
None => match &tab.location { None => match &tab.location {
@ -6194,11 +6194,11 @@ impl Application for App {
.button_height(32) .button_height(32)
.button_spacing(space_xxs) .button_spacing(space_xxs)
.enable_tab_drag(String::from("x-cosmic-files/tab-dnd")) .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.) .tab_drag_threshold(25.)
.on_activate(Message::TabActivate) .on_activate(Message::TabActivate)
.on_close(|entity| Message::TabClose(Some(entity))) .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_leave(|_| Message::DndExitTab)
.on_dnd_drop(|entity, data, action| { .on_dnd_drop(|entity, data, action| {
Message::DndDropTab(entity, data, action) Message::DndDropTab(entity, data, action)

View file

@ -798,7 +798,7 @@ impl App {
}; };
search_location.map(|search_location| { search_location.map(|search_location| {
return ( (
Location::Search( Location::Search(
search_location, search_location,
term, term,
@ -806,7 +806,7 @@ impl App {
Instant::now(), Instant::now(),
), ),
true, true,
); )
}) })
} }
None => match &self.tab.location { None => match &self.tab.location {

View file

@ -395,7 +395,7 @@ where
update( update(
self, self,
&event, event,
layout, layout,
cursor, cursor,
shell, shell,

View file

@ -762,13 +762,12 @@ impl Operation {
OperationError::from_err(e, &controller) OperationError::from_err(e, &controller)
})?; })?;
if let Ok(modified) = metadata.modified() { if let Ok(modified) = metadata.modified()
if let Some(last_modified) = && let Some(last_modified) =
archive::system_time_to_zip_date_time(modified) archive::system_time_to_zip_date_time(modified)
{ {
zip_options = zip_options =
zip_options.last_modified_time(last_modified); zip_options.last_modified_time(last_modified);
}
} }
#[cfg(unix)] #[cfg(unix)]

View file

@ -8,9 +8,8 @@ use cosmic::{
graphics, graphics,
text::{self, Paragraph}, text::{self, Paragraph},
}, },
alignment::{Horizontal, Vertical}, alignment::Vertical,
clipboard::dnd::DndAction, clipboard::dnd::DndAction,
event,
futures::{self, SinkExt}, futures::{self, SinkExt},
keyboard::Modifiers, keyboard::Modifiers,
padding, stream, padding, stream,
@ -24,7 +23,7 @@ use cosmic::{
iced_core::{mouse::ScrollDelta, widget::tree}, iced_core::{mouse::ScrollDelta, widget::tree},
theme, theme,
widget::{ widget::{
self, DndDestination, DndSource, Id, RcElementWrapper, Space, Widget, self, DndDestination, DndSource, Id, RcElementWrapper, Widget,
menu::{action::MenuAction, key_bind::KeyBind}, menu::{action::MenuAction, key_bind::KeyBind},
space, space,
}, },
@ -32,15 +31,13 @@ use cosmic::{
use i18n_embed::LanguageLoader; use i18n_embed::LanguageLoader;
use icu::{ use icu::{
datetime::{ datetime::{
DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, input::DateTime,
input::{Date, DateTime, Time},
options::TimePrecision, options::TimePrecision,
}, },
locale::preferences::extensions::unicode::keywords::HourCycle, locale::preferences::extensions::unicode::keywords::HourCycle,
}; };
use image::{DynamicImage, ImageDecoder, ImageReader}; use image::{DynamicImage, ImageReader};
use jiff_icu::ConvertFrom; use jiff_icu::ConvertFrom;
use jxl_oxide::integration::JxlDecoder;
use mime_guess::{Mime, mime}; use mime_guess::{Mime, mime};
use regex::Regex; use regex::Regex;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
@ -1284,10 +1281,8 @@ pub mod trash_helpers {
log::warn!("failed to get metadata for trash item {entry:?}: {err}") log::warn!("failed to get metadata for trash item {entry:?}: {err}")
}) { }) {
let name = entry.name.to_string_lossy(); let name = entry.name.to_string_lossy();
if regex.is_match(&name) { if regex.is_match(&name) && !callback(SearchItem::Trash(entry, metadata)) {
if !callback(SearchItem::Trash(entry, metadata)) { break;
break;
}
} }
} }
} }
@ -2601,13 +2596,12 @@ impl Item {
} }
column = column.push(details); column = column.push(details);
if let Some(path) = self.path_opt() { if let Some(path) = self.path_opt()
if self.selected { && self.selected
column = column.push( {
widget::button::standard(fl!("open")) column = column.push(
.on_press(Message::Open(Some(path.clone()))), widget::button::standard(fl!("open")).on_press(Message::Open(Some(path.clone()))),
); );
}
} }
if !settings.is_empty() { if !settings.is_empty() {
@ -5917,12 +5911,13 @@ impl Tab {
}; };
let button_row = button(row.into()); let button_row = button(row.into());
let button_row: Element<_> = let button_row: Element<_> = if item.metadata.is_dir()
if item.metadata.is_dir() && item.location_opt.is_some() { && let Some(location) = item.location_opt.as_ref()
self.dnd_dest(item.location_opt.as_ref().unwrap(), button_row) {
} else { self.dnd_dest(location, button_row)
button_row.into() } else {
}; button_row.into()
};
if item.selected || !drag_items.is_empty() { if item.selected || !drag_items.is_empty() {
let dnd_row = if !item.selected { let dnd_row = if !item.selected {
@ -6289,8 +6284,7 @@ impl Tab {
if item.selected { if item.selected {
item.location_opt item.location_opt
.as_ref() .as_ref()
.map(Location::path_opt) .and_then(Location::path_opt)
.flatten()
.is_some() .is_some()
} else { } else {
false false
@ -6688,17 +6682,15 @@ impl Tab {
// Don't send if the result is too old // Don't send if the result is too old
if let Some(last_modified) = if let Some(last_modified) =
*last_modified_opt.read().unwrap() *last_modified_opt.read().unwrap()
{ && let SearchItem::Path(_, _, ref metadata) =
if let SearchItem::Path(_, _, ref metadata) =
search_item search_item
{ {
if let Ok(modified) = metadata.modified() { if let Ok(modified) = metadata.modified() {
if modified < last_modified { if modified < last_modified {
return true;
}
} else {
return true; return true;
} }
} else {
return true;
} }
} }