Skip to content

Commit 0f4d4b1

Browse files
committed
fix: fuzz_write
1 parent 4c492f2 commit 0f4d4b1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fuzz_write/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,10 @@ fn do_operation(
254254
"let mut writer = ZipWriter::new_append(writer.finish()?)?;"
255255
)?;
256256
replace_with_or_abort(writer, |old_writer: zip::ZipWriter<Cursor<Vec<u8>>>| {
257-
zip::ZipWriter::new_append(old_writer.finish()?).unwrap_or_else(|_| {
257+
let get_writer = || -> ZipResult<zip::ZipWriter<Cursor<Vec<u8>>>> {
258+
zip::ZipWriter::new_append(old_writer.finish()?)
259+
};
260+
get_writer().unwrap_or_else(|_| {
258261
if panic_on_error {
259262
panic!("Failed to create new ZipWriter")
260263
}
@@ -272,7 +275,8 @@ fn do_operation(
272275
"let mut writer = ZipWriter::new_append(writer.finish()?)?;"
273276
)?;
274277
replace_with_or_abort(writer, |old_writer| {
275-
zip::ZipWriter::new_append(old_writer.finish()?).unwrap_or_else(|_| {
278+
let get_writer = || {zip::ZipWriter::new_append(old_writer.finish()?)};
279+
get_writer().unwrap_or_else(|_| {
276280
if panic_on_error {
277281
panic!("Failed to create new ZipWriter")
278282
}

0 commit comments

Comments
 (0)