Skip to content

manual_non_exhaustive should not warn on a used enum variant #5714

Closed
@DomWilliams0

Description

@DomWilliams0

I have an enum similar to the following:

enum State {
        /// Temporary value to use in place of uninitialized memory, for safe handling of panics
        #[doc(hidden)]
        _Ephemeral,

        Uninit(...),
        Init(...),
    }

Clippy suggests that I remove the _Ephemeral variant in place of #[non_exhaustive], which wouldn't work in this case as _Ephemeral is used, so removing it would be an error. I think the lint should only complain if the variant isn't actually used?

cargo clippy -V
clippy 0.0.212 (feb3536 2020-06-09)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveS-needs-discussionStatus: Needs further discussion before merging or work can be started

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions