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

Lint for not using field pattern shorthands where applicable. #17792

Closed
eddyb opened this issue Oct 5, 2014 · 0 comments · Fixed by #17813
Closed

Lint for not using field pattern shorthands where applicable. #17792

eddyb opened this issue Oct 5, 2014 · 0 comments · Fixed by #17813
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@eddyb
Copy link
Member

eddyb commented Oct 5, 2014

match p {
    Point { x: x, y: ref y } => ...
}
// can be written as
match p {
    Point { x, ref y } => ...
}

Sadly, there is no obvious way to check for this.
Both forms use the same AST, and only the pattern has a Span at all.

@eddyb eddyb added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Oct 5, 2014
ftxqxd added a commit to ftxqxd/rust that referenced this issue Oct 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant