Skip to content

Commit

Permalink
fix: resolve new clippy warnings on nightly (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
RisaI authored Nov 18, 2024
1 parent 0663292 commit 1f2957d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/read/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl ZipStreamFileMetadata {
self.name()
.chars()
.next_back()
.map_or(false, |c| c == '/' || c == '\\')
.is_some_and(|c| c == '/' || c == '\\')
}

/// Returns whether the file is a regular file
Expand Down
2 changes: 1 addition & 1 deletion src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ pub(crate) fn is_dir(filename: &str) -> bool {
filename
.chars()
.next_back()
.map_or(false, |c| c == '/' || c == '\\')
.is_some_and(|c| c == '/' || c == '\\')
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ impl ZipFileData {
extra_field_length: extra_field_len.checked_add(central_extra_field_len).ok_or(
ZipError::InvalidArchive("Extra field length in central directory exceeds 64KiB"),
)?,
file_comment_length: self.file_comment.as_bytes().len().try_into().unwrap(),
file_comment_length: self.file_comment.len().try_into().unwrap(),
disk_number: 0,
internal_file_attributes: 0,
external_file_attributes: self.external_attributes,
Expand Down
6 changes: 3 additions & 3 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,9 @@ impl<W: Write + Seek> ZipWriter<W> {
),
_ => (options.compression_method, None),
};
let header_end = header_start
+ size_of::<ZipLocalEntryBlock>() as u64
+ name.to_string().as_bytes().len() as u64;
let header_end =
header_start + size_of::<ZipLocalEntryBlock>() as u64 + name.to_string().len() as u64;

if options.alignment > 1 {
let extra_data_end = header_end + extra_data.len() as u64;
let align = options.alignment as u64;
Expand Down

0 comments on commit 1f2957d

Please sign in to comment.