rust-lang/rust-clippy

New lint: wildcard pattern in let

Open

#4.090 geöffnet am 13. Mai 2019

Auf GitHub ansehen
 (9 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.391 Forks)batch import
A-lintL-restrictiongood first issue

Repository-Metriken

Stars
 (10.406 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 22h) (113 gemergte PRs in 30 T)

Beschreibung

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
}

Contributor Guide