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

feat: support #[deprecated] on enum variants #933

Merged
merged 1 commit into from
Apr 14, 2024

Commits on Mar 19, 2024

  1. feat: support #[deprecated] on enum variants

    While the #[deprecated] attribute was already used on structs, fns and
    enums, it was not implemented for enum variants. The information about
    enum variants is already available via `variant.body.annotations`, so
    the support for the #[deprecated] attribute on enum-variant level is
    more or less only another pair of entries within the `EnumConfig`.
    
    This commit adds two new options within the `[enum]` settings:
    
    - deprecated_variant, and
    - deprecated_variant_with_notes
    
    Both get active only on #[deprecated] variants, e.g.,
    
         #[repr(u8)]
         enum ApiLevel {
             #[deprecated(note = "Legacy Support until 2025")]
             L1 = 1,
             #[deprecated]
             L2 = 2,
             L3 = 3,
             L4 = 4,
        }
    
    For enums with struct variants, the current struct deprecation methods
    are already working good enough (see tests/expecations/deprecated*).
    bkaestner committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    be59618 View commit details
    Browse the repository at this point in the history