Skip to content

Should non_snake_case lint ignore identifiers with leading _ ? #32653

Closed
@pnkfelix

Description

@pnkfelix

We currently have a convention that unused variables that start with _ do not cause the unused variable lint to fire.

Should we put in a similar rule for the non_snake_case lint? (Perhaps just for variables with two leading underscores, __, ?)


In my particular case, I am using things like format!("foo {N}", N=name), and the expanded code causes the non-snake-case lint to fire, because it generates names like __argN ...

I could add an #[allow] annotation to the code in question, but this seems unfortunate to me. (Am I the only one who finds format strings easier to read if I use short capital letters for the named substitutions?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-needs-decisionIssue: In need of a decision.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions