From 8782bbaadbc1b76ae2731d1080edb27dc0d4759b Mon Sep 17 00:00:00 2001 From: Xiaoyang Han Date: Thu, 8 Oct 2026 09:42:49 +0800 Subject: [PATCH] Use equivalent let chains for raw progress and cancelled installs The exact PR97 and integrated c1ff repository gates both stop at two Clippy collapsible_if errors. Collapse only those nested conditions: nonempty raw bytes followed by an existing chunk map, and a successful cancelled-install mutex lock followed by its strict 64-entry cap. Preserve short-circuit order, lock scope, ownership, progress error propagation and every cancellation/stream assertion. Two owned nightly format/parse checks, exact whole-file forward/inverse reconstruction and the complete unchanged-outside-paths tree proof pass. Native Clippy, build and repository tests remain unrun for this candidate. --- src/api/router/snapshot_raw_blob.rs | 8 ++++---- .../storage/native_chunk_map/retention.rs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/api/router/snapshot_raw_blob.rs b/src/api/router/snapshot_raw_blob.rs index 016310cd..fa8fa3c7 100644 --- a/src/api/router/snapshot_raw_blob.rs +++ b/src/api/router/snapshot_raw_blob.rs @@ -377,10 +377,10 @@ impl RawBlobReader { "fixed-view raw stream failed", ) })?; - if part.as_ref().is_some_and(|bytes| !bytes.is_empty()) { - if let Some(map) = self.map.as_ref() { - map.record_progress().await?; - } + if part.as_ref().is_some_and(|bytes| !bytes.is_empty()) + && let Some(map) = self.map.as_ref() + { + map.record_progress().await?; } Ok(part) } diff --git a/src/jupiter/storage/native_chunk_map/retention.rs b/src/jupiter/storage/native_chunk_map/retention.rs index 82a74da2..235ec86f 100644 --- a/src/jupiter/storage/native_chunk_map/retention.rs +++ b/src/jupiter/storage/native_chunk_map/retention.rs @@ -409,14 +409,14 @@ impl ChunkMapInstall { impl Drop for ChunkMapInstall { fn drop(&mut self) { - if let Ok(mut cancelled) = self.repository.cancelled_installs.lock() { - if cancelled.len() < 64 { - cancelled.push(CancelledInstall { - owner: self.owner, - key: self.key.key.clone(), - generation: self.generation, - }); - } + if let Ok(mut cancelled) = self.repository.cancelled_installs.lock() + && cancelled.len() < 64 + { + cancelled.push(CancelledInstall { + owner: self.owner, + key: self.key.key.clone(), + generation: self.generation, + }); } let Ok(runtime) = tokio::runtime::Handle::try_current() else { return;