summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/let_underscore_untyped.rs
blob: bcb33c5c7e37e713f2b04e0d276e2d16eda5f44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![allow(unused)]
#![warn(clippy::let_underscore_untyped)]

use std::future::Future;
use std::{boxed::Box, fmt::Display};

fn a() -> u32 {
    1
}

fn b<T>(x: T) -> T {
    x
}

fn c() -> impl Display {
    1
}

fn d(x: &u32) -> &u32 {
    x
}

fn e() -> Result<u32, ()> {
    Ok(1)
}

fn f() -> Box<dyn Display> {
    Box::new(1)
}

fn main() {
    let _ = a();
    let _ = b(1);
    let _ = c();
    let _ = d(&1);
    let _ = e();
    let _ = f();

    _ = a();
    _ = b(1);
    _ = c();
    _ = d(&1);
    _ = e();
    _ = f();

    let _: u32 = a();
    let _: u32 = b(1);
    let _: &u32 = d(&1);
    let _: Result<_, _> = e();
    let _: Box<_> = f();

    #[allow(clippy::let_underscore_untyped)]
    let _ = a();
}