Use unwrap to check that abort_file never fails
This commit is contained in:
parent
e8208dda87
commit
31998d90e9
1 changed files with 4 additions and 4 deletions
|
@ -226,7 +226,7 @@ impl<W: Write + Seek> Write for ZipWriter<W> {
|
||||||
if self.stats.bytes_written > spec::ZIP64_BYTES_THR
|
if self.stats.bytes_written > spec::ZIP64_BYTES_THR
|
||||||
&& !self.files.last_mut().unwrap().large_file
|
&& !self.files.last_mut().unwrap().large_file
|
||||||
{
|
{
|
||||||
let _ = self.abort_file();
|
self.abort_file().unwrap();
|
||||||
return Err(io::Error::new(
|
return Err(io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
"Large file option has not been set",
|
"Large file option has not been set",
|
||||||
|
@ -527,7 +527,7 @@ impl<W: Write + Seek> ZipWriter<W> {
|
||||||
.prepare_next_writer(options.compression_method, options.compression_level)?;
|
.prepare_next_writer(options.compression_method, options.compression_level)?;
|
||||||
self.start_entry(name, options, None)?;
|
self.start_entry(name, options, None)?;
|
||||||
if let Err(e) = self.inner.switch_to(make_new_self) {
|
if let Err(e) = self.inner.switch_to(make_new_self) {
|
||||||
let _ = self.abort_file();
|
self.abort_file().unwrap();
|
||||||
return Err(e);
|
return Err(e);
|
||||||
}
|
}
|
||||||
self.writing_to_file = true;
|
self.writing_to_file = true;
|
||||||
|
@ -692,7 +692,7 @@ impl<W: Write + Seek> ZipWriter<W> {
|
||||||
let file = self.files.last_mut().unwrap();
|
let file = self.files.last_mut().unwrap();
|
||||||
|
|
||||||
if let Err(e) = validate_extra_data(file) {
|
if let Err(e) = validate_extra_data(file) {
|
||||||
let _ = self.abort_file();
|
self.abort_file().unwrap();
|
||||||
return Err(e);
|
return Err(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ impl<W: Write + Seek> ZipWriter<W> {
|
||||||
{
|
{
|
||||||
Ok(writer) => writer,
|
Ok(writer) => writer,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let _ = self.abort_file();
|
self.abort_file().unwrap();
|
||||||
return Err(e);
|
return Err(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue