From 7d7c8eeedb5ca0a5f0c76255baf5debe0ac23da1 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Wed, 28 Feb 2024 11:52:24 +0800 Subject: [PATCH] Simplify the code --- yazi-core/src/tab/commands/shell.rs | 2 +- yazi-core/src/tab/tab.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yazi-core/src/tab/commands/shell.rs b/yazi-core/src/tab/commands/shell.rs index 9eecbc1b..50545948 100644 --- a/yazi-core/src/tab/commands/shell.rs +++ b/yazi-core/src/tab/commands/shell.rs @@ -26,7 +26,7 @@ impl Tab { } let mut opt = opt.into() as Opt; - let selected: Vec<_> = self.hovered_and_selected().into_iter().cloned().collect(); + let selected = self.hovered_and_selected().into_iter().cloned().collect(); tokio::spawn(async move { if !opt.confirm || opt.exec.is_empty() { diff --git a/yazi-core/src/tab/tab.rs b/yazi-core/src/tab/tab.rs index 076c76a9..34e9f481 100644 --- a/yazi-core/src/tab/tab.rs +++ b/yazi-core/src/tab/tab.rs @@ -60,7 +60,7 @@ impl Tab { pub fn hovered_and_selected(&self) -> Vec<&Url> { if let Some(h) = self.current.hovered() { - [&h.url].iter().copied().chain(self.selected.iter()).collect() + [&h.url].into_iter().chain(self.selected.iter()).collect() } else { vec![] }