Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
striezel committed Aug 29, 2023
1 parent 21a2058 commit 046c94b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '\\')
}

Expand Down Expand Up @@ -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 => {
Expand Down
3 changes: 1 addition & 2 deletions src/read/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '\\')
}

Expand Down
2 changes: 1 addition & 1 deletion src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl<W: Write + io::Seek> ZipWriter<W> {
}
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));
Expand Down

0 comments on commit 046c94b

Please sign in to comment.