From 07d2747efcd1860e062bbd7a29f1efec07ab3a11 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 10:02:58 -0500 Subject: [PATCH] craft-cloud-local: collapse the etag conflict check into one let chain The current clippy denies collapsible_if here. Behaviour is unchanged. A missing file still has nothing to conflict with. --- crates/cloud-local/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs index c9c11c015..7f7f56590 100644 --- a/crates/cloud-local/src/lib.rs +++ b/crates/cloud-local/src/lib.rs @@ -190,10 +190,10 @@ fn read(root: &Path, entry: &Entry) -> Result, Fault> { /// conflict with, the same way a provider treats a deleted document. fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { let file = resolve(root, &entry.id)?; - if let Ok(meta) = fs::metadata(&file) { - if Some(etag_of(&meta)) != entry.etag { - return Err(Fault::Conflict); - } + if let Ok(meta) = fs::metadata(&file) + && Some(etag_of(&meta)) != entry.etag + { + return Err(Fault::Conflict); } if let Some(parent) = file.parent() { fs::create_dir_all(parent).map_err(|error| io_fault(&error))?;