Skip to content

Rust shouldn't warn about snake case in patterns #66362

Closed

Description

For example:

enum Animal {
  Spider {
    iHateSnakes: bool,
  },
  ...
}

...

match pet {
  Animal::Spider { iHateSnakes } =>
  ...

This gives you a warning that iHateSnakes should be snake case in the match arm. But at that point you don't really have much choice about it. Variable name warnings should be where the variable is named, and it isn't really named there. (Maybe there's some syntax like { i_hate_snakes @ iHateSnakes } but who is going to bother with that?)

This issue has been assigned to @jumbatm via this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions