summaryrefslogtreecommitdiff
path: root/src/tools/clippy/tests/ui/let_with_type_underscore.rs
blob: 175718b94c8e6a591f8aa87f571491d367452f5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![allow(unused)]
#![warn(clippy::let_with_type_underscore)]
#![allow(clippy::let_unit_value)]

fn func() -> &'static str {
    ""
}

fn main() {
    // Will lint
    let x: _ = 1;
    let _: _ = 2;
    let x: _ = func();

    let x = 1; // Will not lint, Rust inferres this to an integer before Clippy
    let x = func();
    let x: Vec<_> = Vec::<u32>::new();
    let x: [_; 1] = [1];
}