Skip to content

Identifiers beginning with '__' are not required to be snake case #32683

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
wants to merge 4 commits into from
Closed

Identifiers beginning with '__' are not required to be snake case #32683

wants to merge 4 commits into from

Conversation

jonathanbuchanan
Copy link

This change fixes #32653. As suggested by @pnkfelix, a snake case check will return true when the string begins with '__', even if it is not snake case.

This code normally produces an error:
format!("foo {N}", N=name)

This happens because the code generates a variable named __argN, which does not comply with the snake case lint. However, under the patch, that would not cause the lint to throw a warning because it begins with two underscores.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jroesch (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@frewsxcv
Copy link
Member

frewsxcv commented Apr 2, 2016

Related: #19475

@alexcrichton
Copy link
Member

Thanks for the PR! Modifications of lints, however, are pretty serious at this stage of the game so this likely needs to go through an RFC-like review at this point. I'd encourage you to start a discussion on our internals forum first if you'd like to still pursue this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should non_snake_case lint ignore identifiers with leading _ ?
5 participants