From a1c7e6908a26e10f6e1f23a51721664b5e2d838d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 02:53:53 +0900 Subject: chore(style): cargo fmt --- crates/shirabe/src/package/comparer/comparer.rs | 30 ++++++++++++++++++++----- crates/shirabe/src/package/comparer/mod.rs | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 crates/shirabe/src/package/comparer/mod.rs (limited to 'crates/shirabe/src/package/comparer') diff --git a/crates/shirabe/src/package/comparer/comparer.rs b/crates/shirabe/src/package/comparer/comparer.rs index 8f7f312..0e0d295 100644 --- a/crates/shirabe/src/package/comparer/comparer.rs +++ b/crates/shirabe/src/package/comparer/comparer.rs @@ -81,17 +81,26 @@ impl Comparer { let dest_file_hash = destination.get(dir).and_then(|d| d.get(file)); if let Some(dest_hash) = dest_file_hash { if hash != dest_hash { - self.changed.entry("changed".to_string()).or_default().push(format!("{}/{}", dir, file)); + self.changed + .entry("changed".to_string()) + .or_default() + .push(format!("{}/{}", dir, file)); } } else { - self.changed.entry("removed".to_string()).or_default().push(format!("{}/{}", dir, file)); + self.changed + .entry("removed".to_string()) + .or_default() + .push(format!("{}/{}", dir, file)); } } } for (dir, value) in &destination { for (file, _hash) in value { if !source.get(dir).map_or(false, |d| d.contains_key(file)) { - self.changed.entry("added".to_string()).or_default().push(format!("{}/{}", dir, file)); + self.changed + .entry("added".to_string()) + .or_default() + .push(format!("{}/{}", dir, file)); } } } @@ -106,8 +115,13 @@ impl Comparer { } let path = format!("{}/{}", dir, file); if Path::new(&path).is_symlink() { - let link_target = std::fs::read_link(&path).ok().and_then(|p| p.to_str().map(|s| s.to_string())); - array.entry(dir.to_string()).or_default().insert(file, link_target); + let link_target = std::fs::read_link(&path) + .ok() + .and_then(|p| p.to_str().map(|s| s.to_string())); + array + .entry(dir.to_string()) + .or_default() + .insert(file, link_target); } else if Path::new(&path).is_dir() { if array.is_empty() { array.insert("0".to_string(), IndexMap::new()); @@ -118,7 +132,11 @@ impl Comparer { } else if Path::new(&path).is_file() { let size = std::fs::metadata(&path).map(|m| m.len()).unwrap_or(0); if size > 0 { - let algo = if shirabe_php_shim::PHP_VERSION_ID > 80100 { "xxh3" } else { "sha1" }; + let algo = if shirabe_php_shim::PHP_VERSION_ID > 80100 { + "xxh3" + } else { + "sha1" + }; let hash = shirabe_php_shim::hash_file(algo, &path); array.entry(dir.to_string()).or_default().insert(file, hash); } diff --git a/crates/shirabe/src/package/comparer/mod.rs b/crates/shirabe/src/package/comparer/mod.rs new file mode 100644 index 0000000..4c5c6d2 --- /dev/null +++ b/crates/shirabe/src/package/comparer/mod.rs @@ -0,0 +1 @@ +pub mod comparer; -- cgit v1.3.1