summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/crashes/returns.rs
blob: 8021ed4607dde798fea85e4031c9ae33a6710924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// Test for https://github.com/rust-lang/rust-clippy/issues/1346

#[deny(warnings)]
fn cfg_return() -> i32 {
    #[cfg(unix)]
    return 1;
    #[cfg(not(unix))]
    return 2;
}

#[deny(warnings)]
fn cfg_let_and_return() -> i32 {
    #[cfg(unix)]
    let x = 1;
    #[cfg(not(unix))]
    let x = 2;
    x
}

fn main() {
    cfg_return();
    cfg_let_and_return();
}