Skip to content

Lint warning for pattern bindings with the same name as a variant #4639

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

Closed
nikomatsakis opened this issue Jan 26, 2013 · 5 comments
Closed
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority

Comments

@nikomatsakis
Copy link
Contributor

Related to #4612 and #3070, it would be good to have a lint rule like: If there is ever a variable binding "foo" whose type is an enum E that includes a variant named "foo", report a warning. This should probably be done in the exhaustiveness or type checker so that the warning is reported early in compilation.

I'm tossing on the 1.0 list as another of those "very nice to have when you are dotting your i's and crossing your t's" sort of things.

@huonw
Copy link
Member

huonw commented Dec 19, 2013

Triage: closing as a time-travelling dupe of #10304 combined with #3070, since that one has more discussion.

@pnkfelix
Copy link
Member

�I claim that while #10304 and #3070 will handle the majority of the instances of this, we should probably have a separate solution for this bug on its own.

Why (copy-pasted from #12594): automatic FFI binding generators will in general introduce names that do not fit our capitalization conventions. My opinion is that we should not attempt to force binding generators to follow our conventions in all cases. In a case like this, we can provide a better error message.

Reopening.

@pnkfelix pnkfelix reopened this Feb 27, 2014
@pnkfelix
Copy link
Member

Nominating: suggested categorization: not for 1.0, P-low.

@pnkfelix
Copy link
Member

P-low, not for 1.0.

@ghost
Copy link

ghost commented Dec 3, 2014

Fixed, closing.

@ghost ghost closed this as completed Dec 3, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 25, 2021
Fix camel case postfix for `enum_variant_names` lint

Fix camel case postfix

Fixes: rust-lang#4639

changelog: none
This issue was closed.
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. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority
Projects
None yet
Development

No branches or pull requests

3 participants