From f09129ec46d2694001955961befcae526dc4325f Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sun, 28 Sep 2025 15:23:24 +0800 Subject: [PATCH] .. --- yazi-actor/src/mgr/bulk_rename.rs | 4 ++-- yazi-fs/src/path/path.rs | 3 ++- yazi-fs/src/provider/local/gate.rs | 4 ++-- yazi-fs/src/provider/local/metadata.rs | 6 +++--- yazi-scheduler/src/scheduler.rs | 10 +++++----- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/yazi-actor/src/mgr/bulk_rename.rs b/yazi-actor/src/mgr/bulk_rename.rs index 85e9f8ec..dc135e72 100644 --- a/yazi-actor/src/mgr/bulk_rename.rs +++ b/yazi-actor/src/mgr/bulk_rename.rs @@ -13,7 +13,7 @@ use yazi_parser::VoidOpt; use yazi_proxy::{AppProxy, HIDER, TasksProxy}; use yazi_shared::{OsStrJoin, event::Data, terminal_clear, url::{Component, UrlBuf}}; use yazi_term::tty::TTY; -use yazi_vfs::{VfsFile, maybe_exists, provider::{self, must_identical}}; +use yazi_vfs::{VfsFile, maybe_exists, provider}; use yazi_watcher::WATCHER; use crate::{Actor, Ctx}; @@ -122,7 +122,7 @@ impl BulkRename { selected[n.0].components().take(root).chain([Component::Normal(&n)]).collect(), ); - if maybe_exists(&new).await && !must_identical(&old, &new).await { + if maybe_exists(&new).await && !provider::must_identical(&old, &new).await { failed.push((o, n, anyhow!("Destination already exists"))); } else if let Err(e) = provider::rename(&old, &new).await { failed.push((o, n, e.into())); diff --git a/yazi-fs/src/path/path.rs b/yazi-fs/src/path/path.rs index eb7908fe..fccea699 100644 --- a/yazi-fs/src/path/path.rs +++ b/yazi-fs/src/path/path.rs @@ -14,6 +14,7 @@ pub fn skip_url(url: &UrlBuf, n: usize) -> Cow<'_, OsStr> { #[cfg(windows)] pub fn backslash_to_slash(p: &std::path::Path) -> Cow<'_, std::path::Path> { + use std::{ffi::OsString, path::PathBuf}; let bytes = p.as_os_str().as_encoded_bytes(); // Fast path to skip if there are no backslashes @@ -30,7 +31,7 @@ pub fn backslash_to_slash(p: &std::path::Path) -> Cow<'_, std::path::Path> { for &b in rest { out.push(if b == b'\\' { b'/' } else { b }); } - Cow::Owned(std::path::PathBuf::from(unsafe { OsString::from_encoded_bytes_unchecked(out) })) + Cow::Owned(PathBuf::from(unsafe { OsString::from_encoded_bytes_unchecked(out) })) } #[cfg(test)] diff --git a/yazi-fs/src/provider/local/gate.rs b/yazi-fs/src/provider/local/gate.rs index 322ee19f..d1bea5c8 100644 --- a/yazi-fs/src/provider/local/gate.rs +++ b/yazi-fs/src/provider/local/gate.rs @@ -15,9 +15,9 @@ impl FileBuilder for Gate { self } - fn cha(&mut self, cha: Cha) -> &mut Self { + fn cha(&mut self, _cha: Cha) -> &mut Self { #[cfg(unix)] - self.0.mode(cha.mode.bits() as _); + self.0.mode(_cha.mode.bits() as _); self } diff --git a/yazi-fs/src/provider/local/metadata.rs b/yazi-fs/src/provider/local/metadata.rs index 3f09be55..4944a2ce 100644 --- a/yazi-fs/src/provider/local/metadata.rs +++ b/yazi-fs/src/provider/local/metadata.rs @@ -1,4 +1,4 @@ -use std::fs::{FileTimes, Permissions}; +use std::fs::FileTimes; use crate::cha::Cha; @@ -31,10 +31,10 @@ impl From for FileTimes { } #[cfg(unix)] -impl From for Permissions { +impl From for std::fs::Permissions { fn from(cha: Cha) -> Self { use std::os::unix::fs::PermissionsExt; - Permissions::from_mode(cha.mode.bits() as _) + std::fs::Permissions::from_mode(cha.mode.bits() as _) } } diff --git a/yazi-scheduler/src/scheduler.rs b/yazi-scheduler/src/scheduler.rs index 25af0a83..73862bfa 100644 --- a/yazi-scheduler/src/scheduler.rs +++ b/yazi-scheduler/src/scheduler.rs @@ -9,7 +9,7 @@ use yazi_dds::Pump; use yazi_parser::{app::PluginOpt, tasks::ProcessExecOpt}; use yazi_proxy::TasksProxy; use yazi_shared::{Id, Throttle, url::UrlBuf}; -use yazi_vfs::{provider, unique_name}; +use yazi_vfs::{must_be_dir, provider, unique_name}; use super::{Ongoing, TaskOp}; use crate::{HIGH, LOW, NORMAL, TaskIn, TaskOps, TaskOut, file::{File, FileInDelete, FileInHardlink, FileInLink, FileInPaste, FileInTrash, FileOutDelete, FileOutHardlink, FileOutPaste, FileProgDelete, FileProgHardlink, FileProgLink, FileProgPaste, FileProgTrash}, plugin::{Plugin, PluginInEntry, PluginProgEntry}, prework::{Prework, PreworkInFetch, PreworkInLoad, PreworkInSize, PreworkProgFetch, PreworkProgLoad, PreworkProgSize}, process::{Process, ProcessInBg, ProcessInBlock, ProcessInOrphan, ProcessOutBg, ProcessOutBlock, ProcessOutOrphan, ProcessProgBg, ProcessProgBlock, ProcessProgOrphan}}; @@ -99,7 +99,7 @@ impl Scheduler { let file = self.file.clone(); self.send_micro(id, LOW, async move { if !force { - to = unique_name(to, yazi_vfs::must_be_dir(&from)).await?; + to = unique_name(to, must_be_dir(&from)).await?; } file.paste(FileInPaste { id, from, to, cha: None, cut: true, follow: false, retry: 0 }).await }); @@ -121,7 +121,7 @@ impl Scheduler { let file = self.file.clone(); self.send_micro(id, LOW, async move { if !force { - to = unique_name(to, yazi_vfs::must_be_dir(&from)).await?; + to = unique_name(to, must_be_dir(&from)).await?; } file.paste(FileInPaste { id, from, to, cha: None, cut: false, follow, retry: 0 }).await }); @@ -137,7 +137,7 @@ impl Scheduler { let file = self.file.clone(); self.send_micro(id, LOW, async move { if !force { - to = unique_name(to, yazi_vfs::must_be_dir(&from)).await?; + to = unique_name(to, must_be_dir(&from)).await?; } file.link(FileInLink { id, from, to, cha: None, resolve: false, relative, delete: false }) }); @@ -159,7 +159,7 @@ impl Scheduler { let file = self.file.clone(); self.send_micro(id, LOW, async move { if !force { - to = unique_name(to, yazi_vfs::must_be_dir(&from)).await?; + to = unique_name(to, must_be_dir(&from)).await?; } file.hardlink(FileInHardlink { id, from, to, cha: None, follow }).await });