From 57568c102836d16df741dc003f87fc2619008139 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 3 Nov 2026 08:19:25 +0100 Subject: [PATCH] read-floor: clippy's collapsed ifs and needless borrows in the image fold Co-Authored-By: Claude Opus 5.5 --- crates/huginn-mind/src/image.rs | 8 ++++---- crates/huginn-mind/src/mind.rs | 18 +++++++++--------- crates/huginn-mind/src/query.rs | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/huginn-mind/src/image.rs b/crates/huginn-mind/src/image.rs index 5710926..9d4c71b 100644 --- a/crates/huginn-mind/src/image.rs +++ b/crates/huginn-mind/src/image.rs @@ -102,10 +102,10 @@ impl Image { let receipts = receipts.clone()?; let index = AdmissionIndex::build(&receipts)?; for (type_id, keyed) in envelopes { - if kind_of_type(type_id).is_some() { - if let Some(key) = keyed.keys().find(|key| !index.contains(type_id, key)) { - return Err(integrity(type_id, key, "has no commit receipt")); - } + if kind_of_type(type_id).is_some() + && let Some(key) = keyed.keys().find(|key| !index.contains(type_id, key)) + { + return Err(integrity(type_id, key, "has no commit receipt")); } } let mut ordered: Vec<&HuginnCommitReceipt> = receipts.iter().collect(); diff --git a/crates/huginn-mind/src/mind.rs b/crates/huginn-mind/src/mind.rs index c1674ff..660a813 100644 --- a/crates/huginn-mind/src/mind.rs +++ b/crates/huginn-mind/src/mind.rs @@ -330,10 +330,10 @@ impl Mind { for envelope in writes.iter().chain(std::iter::once(&receipt_envelope)) { self.envelopes.entry(envelope.r#type.clone()).or_default().insert(envelope.key.clone(), envelope.clone()); } - if receipt.writes.iter().any(|write| write.document_type == HuginnPersonaEntry::TYPE && write.document_key == self.instance.0) { - if let Ok(held) = &mut self.persona_receipt { - *held = Some(receipt.receipt_id.clone()); - } + if receipt.writes.iter().any(|write| write.document_type == HuginnPersonaEntry::TYPE && write.document_key == self.instance.0) + && let Ok(held) = &mut self.persona_receipt + { + *held = Some(receipt.receipt_id.clone()); } let Ok(image) = &mut self.image else { return }; let mut documents = Vec::new(); @@ -349,11 +349,11 @@ impl Mind { Err(_) => faulted = true, } } - if faulted || image.advance(&AdmissionFacts::of(receipt), documents).is_err() { - if let Err(fault) = self.refresh() { - self.image = Err(fault.clone()); - self.persona_receipt = Err(fault); - } + if (faulted || image.advance(&AdmissionFacts::of(receipt), documents).is_err()) + && let Err(fault) = self.refresh() + { + self.image = Err(fault.clone()); + self.persona_receipt = Err(fault); } } } diff --git a/crates/huginn-mind/src/query.rs b/crates/huginn-mind/src/query.rs index f906191..623bb53 100644 --- a/crates/huginn-mind/src/query.rs +++ b/crates/huginn-mind/src/query.rs @@ -791,7 +791,7 @@ impl Mind { let role = CitationRole::from_name(&edge.role).ok_or_else(|| MindRefusal::Unavailable { detail: format!("the evaluator returned an edge in role {:?}, which is not a citation role", edge.role), })?; - typed.push(PipelineEdge { from: ref_of(&edge.from), role, to: ref_of(&edge.to) }); + typed.push(PipelineEdge { from: ref_of(edge.from), role, to: ref_of(edge.to) }); } Some(typed) } else {