aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/filesystem.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 01:16:50 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 02:22:41 +0900
commitefec43b3b8827820cf35fe1b73d8e33f5fe84eb4 (patch)
treea62bbba72324de48be5f8e689559f8d9e288fc61 /crates/shirabe/src/util/filesystem.rs
parentcac18ef73a39b4ac41fa4d6ccb753804d4c42cb7 (diff)
downloadphp-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.gz
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.zst
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.zip
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe/src/util/filesystem.rs')
-rw-r--r--crates/shirabe/src/util/filesystem.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs
index cb0e4a5..50112ea 100644
--- a/crates/shirabe/src/util/filesystem.rs
+++ b/crates/shirabe/src/util/filesystem.rs
@@ -51,7 +51,7 @@ impl Filesystem {
.depth(0)
.r#in(dir);
- finder.len() == 0
+ finder.is_empty()
}
pub fn empty_directory(
@@ -519,11 +519,7 @@ impl Filesystem {
// Returning early-formatted Result is not possible without changing signature; panic to surface in tests.
panic!(
"{}",
- format!(
- "$from ({}) and $to ({}) must be absolute paths.",
- from.to_string(),
- to.to_string()
- )
+ format!("$from ({}) and $to ({}) must be absolute paths.", from, to)
);
}
@@ -584,11 +580,7 @@ impl Filesystem {
if !self.is_absolute_path(from) || !self.is_absolute_path(to) {
panic!(
"{}",
- format!(
- "$from ({}) and $to ({}) must be absolute paths.",
- from.to_string(),
- to.to_string()
- )
+ format!("$from ({}) and $to ({}) must be absolute paths.", from, to)
);
}
@@ -722,8 +714,8 @@ impl Filesystem {
for chunk in explode("/", &path) {
if ".." == chunk && (strlen(&absolute) > 0 || up) {
array_pop(&mut parts);
- up = !(parts.len() == 0 || ".." == end(&parts).unwrap_or_default());
- } else if "." != chunk && "" != chunk {
+ up = !(parts.is_empty() || ".." == end(&parts).unwrap_or_default());
+ } else if "." != chunk && !chunk.is_empty() {
parts.push(chunk.clone());
up = ".." != chunk;
}