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

ambigous_pattern lint #2378

Open
SoniEx2 opened this Issue Jan 18, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@SoniEx2
Copy link

SoniEx2 commented Jan 18, 2018

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*/},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.