Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

fmt: rustfmt the #1547 save path and test

Claudef55bc64d50da
diff --git a/crates/automation/src/headless.rs b/crates/automation/src/headless.rs
index 736c4d290..51b0a9bc9 100644
--- a/crates/automation/src/headless.rs
+++ b/crates/automation/src/headless.rs
@@ -146,9 +146,8 @@ impl Headless {
// record the current revision as saved so the session stops reporting `dirty`, and make
// the file the document's path. A flat export (PNG, JPEG, …) is a copy and leaves both
// alone (#1547).
- let ext = format
- .map(|f| f.trim_start_matches('.').to_ascii_lowercase())
- .or_else(|| target.extension().map(|e| e.to_string_lossy().to_ascii_lowercase()));
+ let ext =
+ format.map(|f| f.trim_start_matches('.').to_ascii_lowercase()).or_else(|| target.extension().map(|e| e.to_string_lossy().to_ascii_lowercase()));
let layered = matches!(ext.as_deref(), Some("psd" | "psb")) || ext.as_deref() == Some(photocraft_format::EXTENSION);
if layered {
// Saving by index must not retarget the next automation command.
diff --git a/crates/automation/tests/layered_save_dirty.rs b/crates/automation/tests/layered_save_dirty.rs
index 0a19277f4..731a52e85 100644
--- a/crates/automation/tests/layered_save_dirty.rs
+++ b/crates/automation/tests/layered_save_dirty.rs
@@ -79,4 +79,4 @@ fn a_flat_export_is_a_copy_and_leaves_the_document_dirty() {
headless.handle("doc.save", json!({})).unwrap();
assert!(!headless.session.active().unwrap().is_dirty());
std::fs::remove_dir_all(dir).unwrap();
-}
\ No newline at end of file
+}