From 31998d90e94235126ce3d66efb87acbdd2a36633 Mon Sep 17 00:00:00 2001 From: Chris Hennick Date: Thu, 4 May 2023 11:45:33 -0700 Subject: [PATCH] Use unwrap to check that abort_file never fails --- src/write.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/write.rs b/src/write.rs index 8ade9ea1..286a2bb1 100644 --- a/src/write.rs +++ b/src/write.rs @@ -226,7 +226,7 @@ impl Write for ZipWriter { if self.stats.bytes_written > spec::ZIP64_BYTES_THR && !self.files.last_mut().unwrap().large_file { - let _ = self.abort_file(); + self.abort_file().unwrap(); return Err(io::Error::new( io::ErrorKind::Other, "Large file option has not been set", @@ -527,7 +527,7 @@ impl ZipWriter { .prepare_next_writer(options.compression_method, options.compression_level)?; self.start_entry(name, options, None)?; if let Err(e) = self.inner.switch_to(make_new_self) { - let _ = self.abort_file(); + self.abort_file().unwrap(); return Err(e); } self.writing_to_file = true; @@ -692,7 +692,7 @@ impl ZipWriter { let file = self.files.last_mut().unwrap(); if let Err(e) = validate_extra_data(file) { - let _ = self.abort_file(); + self.abort_file().unwrap(); return Err(e); } @@ -702,7 +702,7 @@ impl ZipWriter { { Ok(writer) => writer, Err(e) => { - let _ = self.abort_file(); + self.abort_file().unwrap(); return Err(e); } };