Skip to content

New Lint: Explicit ranges with p0 | ... | p_n => range pat #4931

Description

@Centril

Category: Complexity

Consider:

match x {
    1 | 2 | 4 | 3 => 0,
     _ => 1,
}

Ostensibly the or-pattern would be more clearly written as 1..=4.

I would suggest making the analysis on HAIR.

cc @oli-obk cc rust-lang/rust#67488

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-complexityLint: Belongs in the complexity lint groupL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions