From c198e559a694ee7584988b24445004eac3a97db6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 13:03:59 -0500 Subject: [PATCH 1/2] fix: resolve 4 clippy errors in format crate --- crates/format/src/container.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/format/src/container.rs b/crates/format/src/container.rs index 32133b2b0..42082db6a 100644 --- a/crates/format/src/container.rs +++ b/crates/format/src/container.rs @@ -90,9 +90,12 @@ pub struct Writer { resolved: usize, limits: Limits, /// Which written parts to record for a signature, and the records so far. - tracked: Option<(fn(&str) -> bool, Vec)>, + tracked: Option, } +/// A tracking closure and the part digests collected so far. +type TrackedParts = (fn(&str) -> bool, Vec); + impl Writer { pub fn new(limits: Limits) -> Writer { Writer { zip: craft_zip::Writer::new(), names: BTreeSet::new(), expanded: 0, resolved: 0, limits, tracked: None } @@ -111,7 +114,7 @@ impl Writer { /// The container's bytes. pub fn finish(self) -> Result, FormatError> { - Ok(self.zip.finish().map_err(invalid)?) + self.zip.finish().map_err(invalid) } /// Add a part, compressed or stored. A name already written is written once. @@ -179,6 +182,7 @@ impl Writer { /// declared size), not the parts. pub struct Reader { /// The raw archive bytes, kept alive so the archive can borrow them. + #[allow(dead_code)] bytes: Vec, archive: craft_zip::Archive<'static>, blobs: BTreeMap>, @@ -213,11 +217,10 @@ impl Reader { // no path components that are "." or "..", and no duplicates. let mut name_set = BTreeSet::new(); for entry_idx in 0..archive.len() { - if let Ok(Some(name)) = archive.entry_name(entry_idx) { - if name.is_empty() || name.contains('\\') || name.split('/').any(|c| c.is_empty() || c == "." || c == "..") || !name_set.insert(name) - { - return Err(invalid("duplicate or invalid archive entry")); - } + if let Ok(Some(name)) = archive.entry_name(entry_idx) + && (name.is_empty() || name.contains('\\') || name.split('/').any(|c| c.is_empty() || c == "." || c == "..") || !name_set.insert(name)) + { + return Err(invalid("duplicate or invalid archive entry")); } } From d292422de90c113e76469c5e473b34895dd86895 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 18:44:43 +0000 Subject: [PATCH 2/2] Format container entry validation condition --- crates/format/src/container.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/format/src/container.rs b/crates/format/src/container.rs index 42082db6a..d29b3a9b7 100644 --- a/crates/format/src/container.rs +++ b/crates/format/src/container.rs @@ -218,7 +218,10 @@ impl Reader { let mut name_set = BTreeSet::new(); for entry_idx in 0..archive.len() { if let Ok(Some(name)) = archive.entry_name(entry_idx) - && (name.is_empty() || name.contains('\\') || name.split('/').any(|c| c.is_empty() || c == "." || c == "..") || !name_set.insert(name)) + && (name.is_empty() + || name.contains('\\') + || name.split('/').any(|c| c.is_empty() || c == "." || c == "..") + || !name_set.insert(name)) { return Err(invalid("duplicate or invalid archive entry")); }