chore: clippy
This commit is contained in:
parent
3b1bc4430b
commit
6e2eafe16c
5 changed files with 38 additions and 47 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ where
|
|||
|
||||
update(
|
||||
self,
|
||||
&event,
|
||||
event,
|
||||
layout,
|
||||
cursor,
|
||||
shell,
|
||||
|
|
|
|||
|
|
@ -762,14 +762,13 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
|
|
|
|||
38
src/tab.rs
38
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,14 +1281,12 @@ 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)) {
|
||||
if regex.is_match(&name) && !callback(SearchItem::Trash(entry, metadata)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn uri_to_path(uri: String) -> Option<PathBuf> {
|
||||
|
|
@ -2601,14 +2596,13 @@ impl Item {
|
|||
}
|
||||
column = column.push(details);
|
||||
|
||||
if let Some(path) = self.path_opt() {
|
||||
if self.selected {
|
||||
if let Some(path) = self.path_opt()
|
||||
&& self.selected
|
||||
{
|
||||
column = column.push(
|
||||
widget::button::standard(fl!("open"))
|
||||
.on_press(Message::Open(Some(path.clone()))),
|
||||
widget::button::standard(fl!("open")).on_press(Message::Open(Some(path.clone()))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if !settings.is_empty() {
|
||||
let mut section = widget::settings::section();
|
||||
|
|
@ -5917,9 +5911,10 @@ 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)
|
||||
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()
|
||||
};
|
||||
|
|
@ -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,8 +6682,7 @@ 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() {
|
||||
|
|
@ -6700,7 +6693,6 @@ impl Tab {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match results_tx.blocking_send(search_item) {
|
||||
Ok(()) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue