Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve new clippy warnings on nightly #262

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -90,7 +90,7 @@
/// The file size at which a ZIP64 record becomes necessary.
///
/// If a file larger than this threshold attempts to be written, compressed or uncompressed, and
/// [`FileOptions::large_file()`](crate::write::FileOptions) was not true, then [`ZipWriter`] will

Check warning on line 93 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

unresolved link to `ZipWriter`

Check warning on line 93 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--all-features)

unresolved link to `ZipWriter`

Check warning on line 93 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs

unresolved link to `ZipWriter`
/// raise an [`io::Error`] with [`io::ErrorKind::Other`].
///
/// If the zip file itself is larger than this value, then a zip64 central directory record will be
Expand Down Expand Up @@ -135,7 +135,7 @@
/// The number of entries within a single zip necessary to allocate a zip64 central
/// directory record.
///
/// If more than this number of entries is written to a [`ZipWriter`], then [`ZipWriter::finish()`]

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

unresolved link to `ZipWriter`

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

unresolved link to `ZipWriter::finish`

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--all-features)

unresolved link to `ZipWriter`

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--all-features)

unresolved link to `ZipWriter::finish`

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs

unresolved link to `ZipWriter`

Check warning on line 138 in src/spec.rs

View workflow job for this annotation

GitHub Actions / style_and_docs

unresolved link to `ZipWriter::finish`
/// will write out extra zip64 data to the end of the zip file.
pub const ZIP64_ENTRY_THR: usize = u16::MAX as usize;

Expand Down Expand Up @@ -699,7 +699,7 @@
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 @@ -651,8 +651,8 @@
/// read previously-written files and not overwrite them.
///
/// Note: when using an `inner` that cannot overwrite flushed bytes, do not wrap it in a
/// [BufWriter], because that has a [Seek::seek] method that implicitly calls

Check warning on line 654 in src/write.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

unresolved link to `BufWriter`
/// [BufWriter::flush], and ZipWriter needs to seek backward to update each file's header with

Check warning on line 655 in src/write.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

unresolved link to `BufWriter::flush`
/// the size and checksum after writing the body.
///
/// This setting is false by default.
Expand Down Expand Up @@ -911,9 +911,9 @@
),
_ => (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
Loading