Skip to content

refactor: move code to distinct file (datetime, FixedSizeBlock)#733

Merged
Its-Just-Nans merged 28 commits intomasterfrom
Its-Just-Nans-patch-1
Mar 19, 2026
Merged

refactor: move code to distinct file (datetime, FixedSizeBlock)#733
Its-Just-Nans merged 28 commits intomasterfrom
Its-Just-Nans-patch-1

Conversation

@Its-Just-Nans
Copy link
Member

@Its-Just-Nans Its-Just-Nans commented Mar 18, 2026

  • move DateTime to a new datetime.rs
  • move FixedSizeBlock inside spec
  • remove function unsupported_zip_error

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 primarily focuses on refactoring the codebase to improve organization and maintainability. It involves moving the DateTime structure and its extensive implementations into its own file, and consolidating various fixed-size ZIP block definitions into the spec.rs file. These changes aim to create a clearer separation of concerns and make the codebase easier to navigate and understand.

Highlights

  • Code Organization: Moved the DateTime struct and its associated logic to a new dedicated file, src/datetime.rs, improving modularity.
  • ZIP Specification Structs: Relocated FixedSizeBlock implementations and related ZIP block structs (e.g., ZipCentralEntryBlock, ZipLocalEntryBlock) from src/types.rs to src/spec.rs, centralizing ZIP specification-related code.
  • Error Handling Refinement: Replaced the unsupported_zip_error helper function in src/read.rs with direct Err(ZipError::UnsupportedArchive(...)) returns, simplifying error handling.
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.

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
Contributor

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

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

This refactoring successfully reorganizes code by moving DateTime to src/datetime.rs and ZIP block structures to src/spec.rs. The changes relocate code without modifying functionality, and the removal of the unsupported_zip_error helper in favor of direct Err(ZipError::UnsupportedArchive(...)) calls is correctly implemented. No blocking defects found.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Copy link
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

The pull request successfully refactors the DateTime struct and fixed-size block definitions into their own dedicated files, src/datetime.rs and src/spec.rs respectively. This improves modularity and organization within the codebase. The inlining of unsupported_zip_error in src/read.rs also simplifies error handling in those specific locations.


#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipCentralEntryBlock {

Check failure

Code scanning / clippy

no function or associated item named `parse` found for struct `spec::ZipCentralEntryBlock` in the current scope

no function or associated item named `parse` found for struct `spec::ZipCentralEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no method named `magic` found for struct `spec::ZipLocalEntryBlock` in the current scope

no method named `magic` found for struct `spec::ZipLocalEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no associated item named `WRONG_MAGIC_ERROR` found for struct `spec::ZipLocalEntryBlock` in the current scope

no associated item named `WRONG_MAGIC_ERROR` found for struct `spec::ZipLocalEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no method named `from_le` found for struct `spec::ZipLocalEntryBlock` in the current scope

no method named `from_le` found for struct `spec::ZipLocalEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no method named `magic` found for struct `spec::ZipLocalEntryBlock` in the current scope

no method named `magic` found for struct `spec::ZipLocalEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no associated item named `WRONG_MAGIC_ERROR` found for struct `spec::ZipLocalEntryBlock` in the current scope

no associated item named `WRONG_MAGIC_ERROR` found for struct `spec::ZipLocalEntryBlock` in the current scope

#[derive(Copy, Clone, Debug)]
#[repr(packed, C)]
pub(crate) struct ZipLocalEntryBlock {

Check failure

Code scanning / clippy

no method named `from_le` found for struct `spec::ZipLocalEntryBlock` in the current scope

no method named `from_le` found for struct `spec::ZipLocalEntryBlock` in the current scope
@Its-Just-Nans Its-Just-Nans enabled auto-merge March 18, 2026 23:56
@Its-Just-Nans Its-Just-Nans added this pull request to the merge queue Mar 19, 2026
@Its-Just-Nans Its-Just-Nans self-assigned this Mar 19, 2026
Merged via the queue into master with commit 5fe3f1d Mar 19, 2026
130 checks passed
@Its-Just-Nans Its-Just-Nans deleted the Its-Just-Nans-patch-1 branch March 19, 2026 04:14
@Pr0methean Pr0methean mentioned this pull request Mar 19, 2026
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.

1 participant