refactor: refine PathLike and StrandLike traits (#3340)

This commit is contained in:
三咲雅 misaki masa 2025-11-19 18:07:04 +08:00 committed by GitHub
parent 9cd742811a
commit d3ad1c0920
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 1282 additions and 1492 deletions

View file

@ -8,6 +8,9 @@ description = "Yazi SFTP client"
homepage = "https://yazi-rs.github.io"
repository = "https://github.com/sxyazi/yazi"
[lints]
workspace = true
[dependencies]
bitflags = { workspace = true }
parking_lot = { workspace = true }

View file

@ -17,7 +17,7 @@ impl<'a> From<&'a str> for ByteStr<'a> {
fn from(value: &'a str) -> Self { ByteStr(Cow::Borrowed(value.as_bytes())) }
}
impl<'a> From<&'a ByteStr<'a>> for ByteStr<'a> {
impl<'a> From<&'a Self> for ByteStr<'a> {
fn from(value: &'a ByteStr) -> Self { ByteStr(Cow::Borrowed(&value.0)) }
}
@ -67,7 +67,7 @@ impl<'a> ByteStr<'a> {
}
}
pub fn join(&self, other: impl Into<ByteStr<'a>>) -> PathBuf {
pub fn join(&self, other: impl Into<Self>) -> PathBuf {
let other = other.into();
match self.to_path() {
Cow::Borrowed(p) => p.join(other.to_path()),