Skip to content

Cleanup macros around Zeroable & ZeroableOption #116

@BennoLossin

Description

@BennoLossin

The code around the Zeroable and ZeroableOption traits in src/lib.rs has evolved and can benefit from some cleanup for clarity and maintainability.

  1. Reorder definitions and implementations

    • Ensure consistency in placement: put the Zeroable trait and its implementations (including macro invocations) first in the relevant section of src/lib.rs, followed by the ZeroableOption trait and its implementations.
    • This includes all macro definitions & uses related to these traits.
  2. Rename macro for clarity

    • One of the macros is currently named impl_non_zero_int_zeroable_option; it should be renamed to impl_zeroable_option for consistency.
  3. Macro usage for generic impls

    • Use the impl_zeroable_option macro to handle generic impls for types like &T, &mut T, NonNull<T>, and others (for which Option<T> is guaranteed to be zeroable).
    • This requires modifying the macro to support generics like impl_zeroable.

Please make sure your changes abide by the Linux kernel's contribution rules. Before submitting a PR, read and follow the guidelines in CONTRIBUTING.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions