Skip to content

New lint: Suggest using Self::Variant instead of TheType::Variant #4296

Closed
@Centril

Description

@Centril

Since Rust 1.37.0 (hits stable on August 15th 2019) it is possible to use Self:: inside implementations to refer to variants of the Self type. This was stabilized in rust-lang/rust#61682 (see it for tests).

Similar to the suggestion to match and construct via Self(...) or Self { ... } it would be likewise good to suggest matching and constructing through Self::Variant where applicable. This seems consistent with Clippy's sensibilities... :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions