aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/filesystem.rs
diff options
context:
space:
mode:
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;
}