This commit is contained in:
sxyazi 2023-08-09 14:29:15 +08:00
parent 6a7a271742
commit d3f030a3aa
No known key found for this signature in database
13 changed files with 27 additions and 22 deletions

20
Cargo.lock generated
View file

@ -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",

View file

@ -11,6 +11,7 @@ use crate::{Image, Sixel};
static IMAGE_SHOWN: AtomicBool = AtomicBool::new(false);
#[allow(clippy::type_complexity)]
static UEBERZUG: Lazy<Option<UnboundedSender<Option<(PathBuf, Rect)>>>> =
Lazy::new(|| if PREVIEW.adaptor.needs_ueberzug() { Ueberzug::start().ok() } else { None });

View file

@ -1,3 +1,5 @@
#![allow(clippy::unit_arg)]
mod adaptor;
mod image;
mod iterm2;

View file

@ -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(),

View file

@ -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 });
""

View file

@ -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;

View file

@ -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;

View file

@ -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(),

View file

@ -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);

View file

@ -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

View file

@ -56,7 +56,7 @@ impl Watcher {
tx.blocking_send(path).ok();
tx.blocking_send(parent).ok();
}
_ => return,
_ => (),
}
}
},

View file

@ -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());

View file

@ -98,6 +98,7 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
}
// Convert a file mode to a string representation
#[allow(clippy::collapsible_else_if)]
pub fn file_mode(mode: u32) -> 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};