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

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

Closed
Centril opened this issue Jul 23, 2019 · 0 comments · Fixed by #4308
Closed

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

Centril opened this issue Jul 23, 2019 · 0 comments · Fixed by #4308
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@Centril
Copy link
Contributor

Centril commented Jul 23, 2019

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... :)

@flip1995 flip1995 added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Jul 24, 2019
bors added a commit that referenced this issue Jul 31, 2019
Extend the `use_self` lint to suggest uses of `Self::Variant`

Fixes #4296.

changelog: Extend the `use_self` lint to suggest uses of `Self::Variant`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants