rust-lang/rust-clippy

New lint: wildcard pattern in let

Open

#4.090 aberto em 13 de mai. de 2019

Ver no GitHub
 (9 comments) (0 reactions) (0 assignees)Rust (1.391 forks)batch import
A-lintL-restrictiongood first issue

Métricas do repositório

Stars
 (10.406 stars)
Métricas de merge de PR
 (Mesclagem média 19d 22h) (113 fundiu PRs em 30d)

Description

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
}

Guia do colaborador