Skip to content

feat: Migrate to Rust 2024#650

Merged
Pr0methean merged 1 commit intozip-rs:masterfrom
sorairolake:feature/rust-2024
Feb 13, 2026
Merged

feat: Migrate to Rust 2024#650
Pr0methean merged 1 commit intozip-rs:masterfrom
sorairolake:feature/rust-2024

Conversation

@sorairolake
Copy link
Copy Markdown
Contributor

@sorairolake sorairolake commented Feb 12, 2026

The current MSRV of this crate is 1.88, so we can migrate the edition to Rust 2024. The current edition field is 2021, so the edition of this crate is Rust 2021.

Also fixed clippy::manual_is_multiple_of and clippy::collapsible_if by let chains to pass cargo clippy.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @sorairolake, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on upgrading the project's Rust edition to 2024. This migration allows the codebase to adopt newer, more ergonomic language features and ensures compatibility with the latest Rust ecosystem. The changes primarily involve updating the Cargo.toml and refactoring code to utilize modern Rust patterns, leading to a cleaner and more maintainable codebase.

Highlights

  • Rust 2024 Edition Migration: The project has been successfully migrated to the Rust 2024 edition, updating the Cargo.toml to reflect this change and leveraging new language features.
  • Conditional Logic Refactoring: Several instances of nested if let statements have been refactored into the more concise if let ... && let ... pattern, improving code readability and taking advantage of Rust 2024 idioms.
  • Code Formatting and use Statement Reordering: Numerous files have had their use statements reordered and code formatted for consistency, likely due to cargo fmt or similar tooling applied during the edition upgrade.
  • Leap Year Calculation Improvement: The is_leap_year function in src/types.rs was updated to use the is_multiple_of method, enhancing clarity and potentially performance.
Changelog
  • Cargo.toml
    • Updated the Rust edition from 2021 to 2024.
  • benches/merge_archive.rs
    • Reordered use statements.
  • benches/read_entry.rs
    • Reordered use statements.
  • benches/read_metadata.rs
    • Reordered use statements.
  • examples/extract.rs
    • Reordered use statements.
    • Refactored nested if let statements into a single if let ... && let ... pattern.
  • examples/write_sample.rs
    • Reordered use statements.
  • src/aes.rs
    • Refactored Error::new call for improved readability.
    • Formatted assert! macros in tests for consistency.
  • src/compression.rs
    • Added a semicolon to a return statement for consistency.
  • src/crc32.rs
    • Formatted assert! macro for improved readability in tests.
  • src/extra_fields/extended_timestamp.rs
    • Formatted assert! macro for improved readability in tests.
  • src/extra_fields/zipinfo_utf8.rs
    • Reordered use statements.
  • src/legacy/huffman.rs
    • Removed a redundant comment.
    • Formatted assert! macro in tests for improved readability.
  • src/read.rs
    • Reordered use statements.
    • Refactored conditional return statements for consistency.
    • Refactored if let statements into if let ... && let ... patterns.
    • Formatted assert! macro in tests for improved readability.
  • src/read/magic_finder.rs
    • Simplified an if/else block into a single line.
  • src/read/stream.rs
    • Reordered use statements.
  • src/spec.rs
    • Reordered use statements.
  • src/types.rs
    • Reordered use statements.
    • Replaced modulo operations with is_multiple_of for leap year calculation.
    • Formatted assert! macros in tests for improved readability.
  • src/unstable.rs
    • Reordered use statements.
  • src/write.rs
    • Reordered use statements.
    • Refactored conditional logic using if let ... && let ... patterns.
    • Formatted assert! macros in tests for improved readability.
    • Simplified ref mut patterns in GenericZipWriter::ref_mut.
  • tests/aes_encryption.rs
    • Reordered use statements.
  • tests/append_near_4gb.rs
    • Reordered use statements.
  • tests/end_to_end.rs
    • Reordered use statements.
  • tests/invalid_path.rs
    • Formatted assert! macro for improved readability in tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the crate to the Rust 2024 edition. The changes primarily consist of updating the edition in Cargo.toml and applying automatic formatting and lint fixes from cargo fmt and cargo clippy. These include reordering imports, updating macro formatting, and adopting new language features like chained if let expressions and the is_multiple_of method. The changes are correct and improve the codebase's style and clarity in line with the new edition. The pull request looks good to merge.

@Pr0methean Pr0methean added this to the 8.0.0 milestone Feb 12, 2026
@Pr0methean Pr0methean enabled auto-merge February 12, 2026 20:10
@Pr0methean Pr0methean added this pull request to the merge queue Feb 13, 2026
Merged via the queue into zip-rs:master with commit f78b356 Feb 13, 2026
148 of 158 checks passed
@Pr0methean Pr0methean mentioned this pull request Feb 13, 2026
@sorairolake sorairolake deleted the feature/rust-2024 branch February 13, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants