From 8ffc2d154598f4d2ebf57cec3bea9ae0a2dffb30 Mon Sep 17 00:00:00 2001 From: Lireer Date: Fri, 9 Oct 2020 16:19:16 +0200 Subject: [PATCH] cargo fmt and clippy --- src/aes_ctr.rs | 2 +- src/read.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aes_ctr.rs b/src/aes_ctr.rs index efda6b77..9f4c2be4 100644 --- a/src/aes_ctr.rs +++ b/src/aes_ctr.rs @@ -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 diff --git a/src/read.rs b/src/read.rs index 4b60d246..3c22e5be 100644 --- a/src/read.rs +++ b/src/read.rs @@ -54,6 +54,7 @@ pub struct ZipArchive { comment: Vec, } +#[allow(clippy::large_enum_variant)] enum CryptoReader<'a> { Plaintext(io::Take<&'a mut dyn Read>), ZipCrypto(ZipCryptoReaderValid>), @@ -346,7 +347,7 @@ impl ZipArchive { 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", ));