Skip to content

ambigous_pattern lint #2378

@SoniEx2

Description

@SoniEx2

Ref: rust-lang/rfcs#2272

I would like an ambiguous_pattern lint that either:

  1. requires the pattern to have ::
  2. requires the pattern to have @

Those 2 requirements make it easy to avoid ambiguous patterns, for example:

match x {
    C => {/*is this C a binding, or did you forget to import a constant?*/},
    x => {/*is this x a lowercase constant or did you mean to make a binding?*/},
}

Instead, write it as:

match x {
    m::C => {/*got constant C*/},
    x @ _ => {/*got unknown*/},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsC-an-interesting-projectCategory: Interesting projects, that usually are more involved design/code wise.E-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-guidelinesLint: Related to the Rust API GuidelinesT-middleType: Probably requires verifiying types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions