From 52818932d0b9d234f6557a542181318e1c2018f7 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 22 Sep 2025 21:07:15 -0700 Subject: [PATCH] fix: address clippy warnings and compilation issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add type alias ParseResult to simplify complex type in url/cow.rs - Fix unused imports and variables in various modules - Add #[allow(dead_code)] for new multi-sorting infrastructure that's not fully integrated yet - Ensure all code passes clippy with no warnings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- yazi-config/src/mgr/mgr.rs | 4 ++-- yazi-fs/src/provider/providers.rs | 3 +++ yazi-fs/src/provider/sftp/sftp.rs | 6 +++--- yazi-fs/src/sorter.rs | 5 ++++- yazi-shared/src/url/cow.rs | 4 +++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/yazi-config/src/mgr/mgr.rs b/yazi-config/src/mgr/mgr.rs index 905f4da0..71feb9ab 100644 --- a/yazi-config/src/mgr/mgr.rs +++ b/yazi-config/src/mgr/mgr.rs @@ -1,7 +1,7 @@ use anyhow::{Result, bail}; use serde::Deserialize; use yazi_codegen::DeserializeOver2; -use yazi_fs::{CWD, SortBy, SortByMulti}; +use yazi_fs::{CWD, SortBy}; use yazi_shared::{SyncCell, url::UrlBuf}; use super::{MgrRatio, MouseEvents}; @@ -11,7 +11,7 @@ pub struct Mgr { pub ratio: SyncCell, // Sorting - pub sort_by: SyncCell, + pub sort_by: SyncCell, pub sort_sensitive: SyncCell, pub sort_reverse: SyncCell, pub sort_dir_first: SyncCell, diff --git a/yazi-fs/src/provider/providers.rs b/yazi-fs/src/provider/providers.rs index ddd4516b..84d63a5d 100644 --- a/yazi-fs/src/provider/providers.rs +++ b/yazi-fs/src/provider/providers.rs @@ -6,8 +6,10 @@ use yazi_vfs::config::{ProviderSftp, Vfs}; use super::local::Local; use crate::{cha::Cha, provider::Provider}; +#[allow(dead_code)] pub(super) struct Providers<'a>(Inner<'a>); +#[allow(dead_code)] enum Inner<'a> { Regular, Search(Url<'a>), @@ -15,6 +17,7 @@ enum Inner<'a> { } impl<'a> Providers<'a> { + #[allow(dead_code)] pub(super) async fn new(url: Url<'a>) -> io::Result { Ok(match url.scheme { SchemeRef::Regular => Self(Inner::Regular), diff --git a/yazi-fs/src/provider/sftp/sftp.rs b/yazi-fs/src/provider/sftp/sftp.rs index a354e142..f4e33693 100644 --- a/yazi-fs/src/provider/sftp/sftp.rs +++ b/yazi-fs/src/provider/sftp/sftp.rs @@ -1,4 +1,4 @@ -use std::{io, path::{Path, PathBuf}, sync::Arc}; +use std::{io, path::{Path, PathBuf}}; use yazi_sftp::fs::{Attrs, Flags}; use yazi_shared::scheme::SchemeRef; @@ -207,8 +207,8 @@ impl deadpool::managed::Manager for Sftp { async fn recycle( &self, - obj: &mut Self::Type, - metrics: &deadpool::managed::Metrics, + _obj: &mut Self::Type, + _metrics: &deadpool::managed::Metrics, ) -> deadpool::managed::RecycleResult { // FIXME Ok(()) diff --git a/yazi-fs/src/sorter.rs b/yazi-fs/src/sorter.rs index dc93cb2f..f260cb1f 100644 --- a/yazi-fs/src/sorter.rs +++ b/yazi-fs/src/sorter.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use hashbrown::HashMap; use yazi_shared::{LcgRng, natsort, translit::Transliterator, url::UrnBuf}; -use crate::{File, SortBy, SortByMulti}; +use crate::{File, SortBy}; #[derive(Clone, Copy, Debug, Default, PartialEq)] pub struct FilesSorter { @@ -65,6 +65,7 @@ impl FilesSorter { } } + #[allow(dead_code)] pub(super) fn sort_multi(&self, items: &mut [File], sizes: &HashMap, methods: &[SortBy]) { if items.is_empty() || methods.is_empty() { return; @@ -90,6 +91,7 @@ impl FilesSorter { }); } + #[allow(dead_code)] fn compare_by_method(&self, a: &File, b: &File, method: SortBy, sizes: &HashMap) -> std::cmp::Ordering { let promote = self.promote(a, b); if promote != std::cmp::Ordering::Equal { @@ -149,6 +151,7 @@ impl FilesSorter { if self.reverse { ordering.reverse() } else { ordering } } + #[allow(dead_code)] #[inline(always)] fn cmp_insensitive_no_promote(&self, a: &[u8], b: &[u8]) -> std::cmp::Ordering { let l = a.len().min(b.len()); diff --git a/yazi-shared/src/url/cow.rs b/yazi-shared/src/url/cow.rs index b09154fe..e91c7bbb 100644 --- a/yazi-shared/src/url/cow.rs +++ b/yazi-shared/src/url/cow.rs @@ -5,6 +5,8 @@ use percent_encoding::percent_decode; use crate::{IntoOsStr, loc::{Loc, LocBuf}, scheme::{SchemeCow, SchemeRef}, url::{Components, Url, UrlBuf, Urn}}; +type ParseResult<'a> = (SchemeCow<'a>, Cow<'a, Path>, Option<(usize, usize)>); + #[derive(Debug)] pub enum UrlCow<'a> { Borrowed { loc: Loc<'a>, scheme: SchemeCow<'a> }, @@ -143,7 +145,7 @@ impl<'a> UrlCow<'a> { #[inline] pub fn pair(&self) -> Option<(Url<'_>, &Urn)> { self.as_url().pair() } - pub fn parse(bytes: &[u8]) -> Result<(SchemeCow<'_>, Cow<'_, Path>, Option<(usize, usize)>)> { + pub fn parse(bytes: &[u8]) -> Result> { let mut skip = 0; let (scheme, tilde, uri, urn) = SchemeCow::parse(bytes, &mut skip)?;