Fix formatting issues from cargo fmt

This commit is contained in:
Chris Hennick 2023-04-23 14:58:10 -07:00
parent 5e5f5ebe54
commit d3400509bc
No known key found for this signature in database
GPG key ID: 25653935CC8B6C74
4 changed files with 12 additions and 9 deletions

View file

@ -9,8 +9,8 @@ use zip_next::{ZipArchive, ZipWriter};
fn generate_random_archive(size: usize) -> Vec<u8> {
let data = Vec::new();
let mut writer = ZipWriter::new(Cursor::new(data));
let options =
zip_next::write::FileOptions::default().compression_method(zip_next::CompressionMethod::Stored);
let options = zip_next::write::FileOptions::default()
.compression_method(zip_next::CompressionMethod::Stored);
writer.start_file("random.dat", options).unwrap();
let mut bytes = vec![0u8; size];

View file

@ -12,7 +12,8 @@ fn generate_random_archive(count_files: usize, file_size: usize) -> Vec<u8> {
let data = Vec::new();
let mut writer = ZipWriter::new(Cursor::new(data));
let options =
zip_next::write::FileOptions::default().compression_method(zip_next::CompressionMethod::Stored);
zip_next::write::FileOptions::default()
.compression_method(zip_next::CompressionMethod::Stored);
let bytes = vec![0u8; file_size];

View file

@ -12,14 +12,16 @@ fn main() {
std::process::exit(real_main());
}
const METHOD_STORED: Option<zip_next::CompressionMethod> = Some(zip_next::CompressionMethod::Stored);
const METHOD_STORED: Option<zip_next::CompressionMethod> =
Some(zip_next::CompressionMethod::Stored);
#[cfg(any(
feature = "deflate",
feature = "deflate-miniz",
feature = "deflate-zlib"
))]
const METHOD_DEFLATED: Option<zip_next::CompressionMethod> = Some(zip_next::CompressionMethod::Deflated);
const METHOD_DEFLATED: Option<zip_next::CompressionMethod> =
Some(zip_next::CompressionMethod::Deflated);
#[cfg(not(any(
feature = "deflate",
feature = "deflate-miniz",
@ -101,7 +103,7 @@ where
}
}
zip.finish()?;
Result::Ok(())
Ok(())
}
fn doit(

View file

@ -82,7 +82,7 @@ pub(crate) mod zip_writer {
pub(super) writing_to_extra_field: bool,
pub(super) writing_to_central_extra_field_only: bool,
pub(super) writing_raw: bool,
pub(super) comment: Vec<u8>
pub(super) comment: Vec<u8>,
}
}
pub use zip_writer::ZipWriter;
@ -291,7 +291,7 @@ impl<A: Read + Write + Seek> ZipWriter<A> {
writing_to_extra_field: false,
writing_to_central_extra_field_only: false,
comment: footer.zip_file_comment,
writing_raw: true // avoid recomputing the last file's header
writing_raw: true, // avoid recomputing the last file's header
})
}
}
@ -309,7 +309,7 @@ impl<W: Write + Seek> ZipWriter<W> {
writing_to_extra_field: false,
writing_to_central_extra_field_only: false,
writing_raw: false,
comment: Vec::new()
comment: Vec::new(),
}
}