summaryrefslogtreecommitdiffstats
path: root/src/test/ui/let-else/let-else-check.rs
blob: 713fd986e9792bbaa660a461e0aae404166dbee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![deny(unused_variables)]

fn main() {
    // type annotation, attributes
    #[allow(unused_variables)]
    let Some(_): Option<u32> = Some(Default::default()) else {
        let x = 1; // OK
        return;
    };

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

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