From 8810dd38c78b07221894fc31d0788dc3a08279bc Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 6 Feb 2024 08:32:34 +0800 Subject: [PATCH] .. --- yazi-adaptor/src/kitty.rs | 2 +- yazi-adaptor/src/kitty_old.rs | 2 +- yazi-config/src/theme/filetype.rs | 2 +- yazi-config/src/theme/icon.rs | 2 +- yazi-core/src/input/snap.rs | 4 ++-- yazi-fm/src/app/commands/update_progress.rs | 2 +- yazi-fm/src/completion/completion.rs | 4 ++-- yazi-fm/src/help/bindings.rs | 14 +++++++------- yazi-fm/src/select/select.rs | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/yazi-adaptor/src/kitty.rs b/yazi-adaptor/src/kitty.rs index 5462a635..07579528 100644 --- a/yazi-adaptor/src/kitty.rs +++ b/yazi-adaptor/src/kitty.rs @@ -357,7 +357,7 @@ impl Kitty { async fn encode(img: DynamicImage) -> Result> { fn output(raw: &[u8], format: u8, size: (u32, u32)) -> Result> { - let b64 = general_purpose::STANDARD.encode(raw).chars().collect::>(); + let b64: Vec<_> = general_purpose::STANDARD.encode(raw).chars().collect(); let mut it = b64.chunks(4096).peekable(); let mut buf = Vec::with_capacity(b64.len() + it.len() * 50); diff --git a/yazi-adaptor/src/kitty_old.rs b/yazi-adaptor/src/kitty_old.rs index b44d4c59..3c422277 100644 --- a/yazi-adaptor/src/kitty_old.rs +++ b/yazi-adaptor/src/kitty_old.rs @@ -35,7 +35,7 @@ impl KittyOld { async fn encode(img: DynamicImage) -> Result> { fn output(raw: &[u8], format: u8, size: (u32, u32)) -> Result> { - let b64 = general_purpose::STANDARD.encode(raw).chars().collect::>(); + let b64: Vec<_> = general_purpose::STANDARD.encode(raw).chars().collect(); let mut it = b64.chunks(4096).peekable(); let mut buf = Vec::with_capacity(b64.len() + it.len() * 50); diff --git a/yazi-config/src/theme/filetype.rs b/yazi-config/src/theme/filetype.rs index f6bfd8ee..94ffbed0 100644 --- a/yazi-config/src/theme/filetype.rs +++ b/yazi-config/src/theme/filetype.rs @@ -97,7 +97,7 @@ impl Filetype { } .into(), }) - .collect::>(), + .collect(), ) } } diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 17c5a99d..3898334b 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -35,7 +35,7 @@ impl Icon { text: r.text, style: StyleShadow { fg: r.fg, ..Default::default() }.into(), }) - .collect::>(), + .collect(), ) } } diff --git a/yazi-core/src/input/snap.rs b/yazi-core/src/input/snap.rs index 59d405b9..e6f98232 100644 --- a/yazi-core/src/input/snap.rs +++ b/yazi-core/src/input/snap.rs @@ -72,7 +72,7 @@ impl InputSnap { #[inline] pub(super) fn find_window(s: &str, offset: usize, limit: usize) -> Range { let mut width = 0; - let v = s + let v: Vec<_> = s .chars() .enumerate() .skip(offset) @@ -80,7 +80,7 @@ impl InputSnap { width += c.width().unwrap_or(0); if width < limit { Some(i) } else { None } }) - .collect::>(); + .collect(); if v.is_empty() { return 0..0; diff --git a/yazi-fm/src/app/commands/update_progress.rs b/yazi-fm/src/app/commands/update_progress.rs index d8c2ce20..2ab49a79 100644 --- a/yazi-fm/src/app/commands/update_progress.rs +++ b/yazi-fm/src/app/commands/update_progress.rs @@ -26,7 +26,7 @@ impl App { let tasks = &mut self.cx.tasks; tasks.progress = opt.progress; - // If the tasks pane is visible, update the summaries with a complete render. + // If the task manager is visible, update the summaries with a complete render. if tasks.visible { let new = tasks.paginate(); if new.len() != tasks.summaries.len() diff --git a/yazi-fm/src/completion/completion.rs b/yazi-fm/src/completion/completion.rs index 7a7b16e6..05936da1 100644 --- a/yazi-fm/src/completion/completion.rs +++ b/yazi-fm/src/completion/completion.rs @@ -15,7 +15,7 @@ impl<'a> Completion<'a> { impl<'a> Widget for Completion<'a> { fn render(self, rect: Rect, buf: &mut Buffer) { - let items = self + let items: Vec<_> = self .cx .completion .window() @@ -37,7 +37,7 @@ impl<'a> Widget for Completion<'a> { item }) - .collect::>(); + .collect(); let input_area = self.cx.area(&self.cx.input.position); let mut area = Position::sticky(input_area, Offset { diff --git a/yazi-fm/src/help/bindings.rs b/yazi-fm/src/help/bindings.rs index 82121020..b5b56185 100644 --- a/yazi-fm/src/help/bindings.rs +++ b/yazi-fm/src/help/bindings.rs @@ -19,18 +19,18 @@ impl Widget for Bindings<'_> { } // On - let col1 = - bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on)).collect::>(); + let col1: Vec<_> = + bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on.into())).collect(); // Exec - let col2 = - bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec)).collect::>(); + let col2: Vec<_> = + bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec.into())).collect(); // Desc - let col3 = bindings + let col3: Vec<_> = bindings .iter() - .map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc)) - .collect::>(); + .map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc.into())) + .collect(); let chunks = layout::Layout::horizontal([ Constraint::Ratio(2, 10), diff --git a/yazi-fm/src/select/select.rs b/yazi-fm/src/select/select.rs index 5a09f228..52eed6e3 100644 --- a/yazi-fm/src/select/select.rs +++ b/yazi-fm/src/select/select.rs @@ -16,7 +16,7 @@ impl<'a> Widget for Select<'a> { let select = &self.cx.select; let area = self.cx.area(&select.position); - let items = select + let items: Vec<_> = select .window() .iter() .enumerate() @@ -27,7 +27,7 @@ impl<'a> Widget for Select<'a> { ListItem::new(format!(" {v}")).style(THEME.select.active) }) - .collect::>(); + .collect(); widgets::Clear.render(area, buf); List::new(items)