cargo fmt and clippy

This commit is contained in:
Lireer 2020-10-09 16:19:16 +02:00 committed by Lireer
parent e69df5cf64
commit 8ffc2d1545
2 changed files with 3 additions and 2 deletions

View file

@ -97,7 +97,7 @@ where
/// Decrypt or encrypt given data.
#[inline]
fn crypt_in_place(&mut self, mut target: &mut [u8]) {
while target.len() > 0 {
while !target.is_empty() {
if self.pos == AES_BLOCK_SIZE {
// Note: AES block size is always 16 bytes, same as u128.
self.buffer

View file

@ -54,6 +54,7 @@ pub struct ZipArchive<R> {
comment: Vec<u8>,
}
#[allow(clippy::large_enum_variant)]
enum CryptoReader<'a> {
Plaintext(io::Take<&'a mut dyn Read>),
ZipCrypto(ZipCryptoReaderValid<io::Take<&'a mut dyn Read>>),
@ -346,7 +347,7 @@ impl<R: Read + io::Seek> ZipArchive<R> {
let mut files = Vec::new();
let mut names_map = HashMap::new();
if let Err(_) = reader.seek(io::SeekFrom::Start(directory_start)) {
if reader.seek(io::SeekFrom::Start(directory_start)).is_err() {
return Err(ZipError::InvalidArchive(
"Could not seek to start of central directory",
));