summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unused-borrows.rs
blob: 4518522ae00f7eca3371d49a6072fa71be6f2f1d (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
#![deny(unused_must_use)]

fn foo(_: i32) -> bool { todo!() }

fn bar() -> &'static i32 {
    &42;
    //~^ unused

    &mut foo(42);
    //~^ unused

    &&42;
    //~^ unused

    &&mut 42;
    //~^ unused

    &mut &42;
    //~^ unused

    let _result = foo(4)
        && foo(2); // Misplaced semi-colon (perhaps due to reordering of lines)
    && foo(42);
    //~^ unused

    let _ = &42; // ok

    &42 // ok
}

fn main() {
    let _ = bar();
}