Skip to content

New lint: wildcard pattern in let #4090

@Vlad-Shcherbina

Description

@Vlad-Shcherbina

I think there should be a warning about the wildcard pattern in let.
I can't imagine any situation where this makes sense, and there are cases where it's a mistake caused by taking _ for identifier though it's not.

Wrong:

{
    let _ = my scope guard or whatever
    // dropped right away

    do stuff
}

Correct:

{
    let _g = my scope guard or whatever

    do stuff

    // dropped at the end of the scope
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-restrictionLint: Belongs in the restriction lint groupgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions