Skip to content

Commit c04eb69

Browse files
CopilotByron
andcommitted
Address code review comments - add documentation and improve error handling
Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
1 parent d0ae9b5 commit c04eb69

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

gix-archive/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn append_zip_entry<W: std::io::Write + std::io::Seek>(
185185

186186
let (mut zip_entry, config) = file_builder.start().map_err(std::io::Error::other)?;
187187

188-
// Use flate2 for compression
188+
// Use flate2 for compression. Level 9 is the maximum compression level for deflate.
189189
let encoder = flate2::write::DeflateEncoder::new(
190190
&mut zip_entry,
191191
match compression_level {

gix-archive/tests/archive.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ mod from_tree {
174174
let ar = rawzip::ZipArchive::from_slice(buf.as_slice())?;
175175
assert_eq!(
176176
{
177-
let mut n: Vec<_> = ar.entries().filter_map(|e| {
178-
e.ok().map(|entry| {
179-
String::from_utf8_lossy(entry.file_path().as_ref()).to_string()
180-
})
181-
}).collect();
177+
let mut n: Vec<_> = Vec::new();
178+
for entry_result in ar.entries() {
179+
let entry = entry_result?;
180+
n.push(String::from_utf8_lossy(entry.file_path().as_ref()).to_string());
181+
}
182182
n.sort();
183183
n
184184
},

0 commit comments

Comments
 (0)