summaryrefslogtreecommitdiffstats
path: root/src/test/ui/let-else/let-else-allow-in-expr.rs
blob: 39f4c9060fea539e82a3b6bbdbbc2a1af9481c7d (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
#![feature(let_else)]

#![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`
}