diff --git a/src/read.rs b/src/read.rs index b702b4f21..f42b7221a 100644 --- a/src/read.rs +++ b/src/read.rs @@ -935,8 +935,7 @@ impl<'a> ZipFile<'a> { pub fn is_dir(&self) -> bool { self.name() .chars() - .rev() - .next() + .next_back() .map_or(false, |c| c == '/' || c == '\\') } @@ -991,7 +990,7 @@ impl<'a> Drop for ZipFile<'a> { // Get the inner `Take` reader so all decryption, decompression and CRC calculation is skipped. let mut reader: std::io::Take<&mut dyn std::io::Read> = match &mut self.reader { ZipFileReader::NoReader => { - let innerreader = ::std::mem::replace(&mut self.crypto_reader, None); + let innerreader = self.crypto_reader.take(); innerreader.expect("Invalid reader state").into_inner() } reader => { diff --git a/src/read/stream.rs b/src/read/stream.rs index 5a01b23f9..dc967ee89 100644 --- a/src/read/stream.rs +++ b/src/read/stream.rs @@ -184,8 +184,7 @@ impl ZipStreamFileMetadata { pub fn is_dir(&self) -> bool { self.name() .chars() - .rev() - .next() + .next_back() .map_or(false, |c| c == '/' || c == '\\') } diff --git a/src/write.rs b/src/write.rs index 4cdc031b0..cfa43306c 100644 --- a/src/write.rs +++ b/src/write.rs @@ -411,7 +411,7 @@ impl ZipWriter { } if let Some(keys) = options.encrypt_with { let mut zipwriter = crate::zipcrypto::ZipCryptoWriter { writer: core::mem::replace(&mut self.inner, GenericZipWriter::Closed).unwrap(), buffer: vec![], keys }; - let mut crypto_header = [0u8; 12]; + let crypto_header = [0u8; 12]; zipwriter.write_all(&crypto_header)?; self.inner = GenericZipWriter::Storer(MaybeEncrypted::Encrypted(zipwriter));