From d3f030a3aaac0ca657e0b927c7c9519011e5aa95 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Wed, 9 Aug 2023 14:29:15 +0800 Subject: [PATCH] .. --- Cargo.lock | 20 ++++++++++---------- adaptor/src/adaptor.rs | 1 + adaptor/src/lib.rs | 2 ++ app/src/context.rs | 2 +- config/src/keymap/key.rs | 3 +-- core/src/input/snap.rs | 1 - core/src/lib.rs | 7 ++++++- core/src/manager/manager.rs | 4 ++-- core/src/manager/preview.rs | 3 --- core/src/manager/tabs.rs | 2 +- core/src/manager/watcher.rs | 2 +- core/src/tasks/tasks.rs | 1 + shared/src/fs.rs | 1 + 13 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7d4c172..3d25ad41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,9 +193,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "libc", ] @@ -705,9 +705,9 @@ dependencies = [ [[package]] name = "image" -version = "0.24.6" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527909aa81e20ac3a44803521443a765550f09b5130c2c2fa1ea59c2f8f50a3a" +checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" dependencies = [ "bytemuck", "byteorder", @@ -1283,18 +1283,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.182" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb30a74471f5b7a1fa299f40b4bf1be93af61116df95465b2b5fc419331e430" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.182" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4c2c6ea4bc09b5c419012eafcdb0fcef1d9119d626c8f3a0708a5b92d38a70" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", @@ -1488,9 +1488,9 @@ dependencies = [ [[package]] name = "tiff" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7449334f9ff2baf290d55d73983a7d6fa15e01198faef72af07e2a8db851e471" +checksum = "6d172b0f4d3fba17ba89811858b9d3d97f928aece846475bbda076ca46736211" dependencies = [ "flate2", "jpeg-decoder", diff --git a/adaptor/src/adaptor.rs b/adaptor/src/adaptor.rs index f5a96de0..1604fdae 100644 --- a/adaptor/src/adaptor.rs +++ b/adaptor/src/adaptor.rs @@ -11,6 +11,7 @@ use crate::{Image, Sixel}; static IMAGE_SHOWN: AtomicBool = AtomicBool::new(false); +#[allow(clippy::type_complexity)] static UEBERZUG: Lazy>>> = Lazy::new(|| if PREVIEW.adaptor.needs_ueberzug() { Ueberzug::start().ok() } else { None }); diff --git a/adaptor/src/lib.rs b/adaptor/src/lib.rs index 14c952a2..8e6f2bdc 100644 --- a/adaptor/src/lib.rs +++ b/adaptor/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unit_arg)] + mod adaptor; mod image; mod iterm2; diff --git a/app/src/context.rs b/app/src/context.rs index 035218fc..18dc162f 100644 --- a/app/src/context.rs +++ b/app/src/context.rs @@ -14,7 +14,7 @@ pub struct Ctx { impl Ctx { pub(super) fn new() -> Self { Self { - manager: Manager::new(), + manager: Manager::make(), which: Default::default(), select: Default::default(), input: Default::default(), diff --git a/config/src/keymap/key.rs b/config/src/keymap/key.rs index a5d71d07..94e96fa7 100644 --- a/config/src/keymap/key.rs +++ b/config/src/keymap/key.rs @@ -122,7 +122,6 @@ impl ToString for Key { } let code = match self.code { - KeyCode::Char(' ') => "Space", KeyCode::Backspace => "Backspace", KeyCode::Enter => "Enter", KeyCode::Left => "Left", @@ -150,7 +149,7 @@ impl ToString for Key { KeyCode::F(12) => "F12", KeyCode::Esc => "Esc", - KeyCode::Char(c) if c == ' ' => "Space", + KeyCode::Char(' ') => "Space", KeyCode::Char(c) => { s.push(if self.shift { c.to_ascii_uppercase() } else { c }); "" diff --git a/core/src/input/snap.rs b/core/src/input/snap.rs index 22e5126a..a5a9b510 100644 --- a/core/src/input/snap.rs +++ b/core/src/input/snap.rs @@ -47,7 +47,6 @@ impl InputSnap { true } - #[allow(clippy::if_same_then_else)] pub fn visual(&mut self) -> bool { if self.mode != InputMode::Normal { return false; diff --git a/core/src/lib.rs b/core/src/lib.rs index 0a704a3c..d2b49c8b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,4 +1,9 @@ -#![allow(clippy::module_inception)] +#![allow( + clippy::if_same_then_else, + clippy::len_without_is_empty, + clippy::module_inception, + clippy::option_map_unit_fn +)] mod blocker; mod event; diff --git a/core/src/manager/manager.rs b/core/src/manager/manager.rs index 3b047f16..f2f0790a 100644 --- a/core/src/manager/manager.rs +++ b/core/src/manager/manager.rs @@ -17,9 +17,9 @@ pub struct Manager { } impl Manager { - pub fn new() -> Self { + pub fn make() -> Self { Self { - tabs: Tabs::new(), + tabs: Tabs::make(), yanked: Default::default(), watcher: Watcher::start(), diff --git a/core/src/manager/preview.rs b/core/src/manager/preview.rs index 2855d5b0..1d152180 100644 --- a/core/src/manager/preview.rs +++ b/core/src/manager/preview.rs @@ -44,7 +44,6 @@ impl Preview { } } - #[allow(clippy::if_same_then_else)] pub fn go(&mut self, path: &Path, mime: &str, show_image: bool) { let kind = MimeKind::new(mime); if !show_image && matches!(kind, MimeKind::Image | MimeKind::Video) { @@ -75,7 +74,6 @@ impl Preview { })); } - #[allow(clippy::option_map_unit_fn)] pub fn reset(&mut self) -> bool { self.handle.take().map(|h| h.abort()); self.incr.fetch_add(1, Ordering::Relaxed); @@ -88,7 +86,6 @@ impl Preview { ) } - #[allow(clippy::option_map_unit_fn)] pub fn reset_image(&mut self) -> bool { self.handle.take().map(|h| h.abort()); self.incr.fetch_add(1, Ordering::Relaxed); diff --git a/core/src/manager/tabs.rs b/core/src/manager/tabs.rs index d962ac3c..bf4d2890 100644 --- a/core/src/manager/tabs.rs +++ b/core/src/manager/tabs.rs @@ -13,7 +13,7 @@ pub struct Tabs { } impl Tabs { - pub fn new() -> Self { + pub fn make() -> Self { let mut tabs = Self { idx: usize::MAX, items: vec![Tab::new(&MANAGER.cwd)] }; tabs.set_idx(0); tabs diff --git a/core/src/manager/watcher.rs b/core/src/manager/watcher.rs index a005ec9f..18e4b334 100644 --- a/core/src/manager/watcher.rs +++ b/core/src/manager/watcher.rs @@ -56,7 +56,7 @@ impl Watcher { tx.blocking_send(path).ok(); tx.blocking_send(parent).ok(); } - _ => return, + _ => (), } } }, diff --git a/core/src/tasks/tasks.rs b/core/src/tasks/tasks.rs index b1baffb7..8d0f952f 100644 --- a/core/src/tasks/tasks.rs +++ b/core/src/tasks/tasks.rs @@ -38,6 +38,7 @@ impl Tasks { true } + #[allow(clippy::should_implement_trait)] pub fn next(&mut self) -> bool { let limit = Self::limit().min(self.len()); diff --git a/shared/src/fs.rs b/shared/src/fs.rs index 336d771c..75f9ce24 100644 --- a/shared/src/fs.rs +++ b/shared/src/fs.rs @@ -98,6 +98,7 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver String { use libc::{S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR};