summaryrefslogtreecommitdiffstats
path: root/tests/ui/let-else/let-else-allow-in-expr.rs
blob: 33acb6c6a29c5284999002648726be5c8d2a4da9 (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
#![deny(unused_variables)]

fn main() {
    let Some(_): Option<u32> = ({
        let x = 1; //~ ERROR unused variable: `x`
        Some(1)
    }) else {
        return;
    };

    #[allow(unused_variables)]
    let Some(_): Option<u32> = ({
        let x = 1;
        Some(1)
    }) else {
        return;
    };

    let Some(_): Option<u32> = ({
        #[allow(unused_variables)]
        let x = 1;
        Some(1)
    }) else {
        return;
    };

    let x = 1; //~ ERROR unused variable: `x`
}