Files
rust/tests/ui/crashes/returns.rs

25 lines
381 B
Rust
Raw Normal View History

2025-02-11 17:57:08 +01:00
//@ check-pass
// Test for https://github.com/rust-lang/rust-clippy/issues/1346
2016-11-20 10:15:40 +09:00
#[deny(warnings)]
fn cfg_return() -> i32 {
2018-12-09 23:26:16 +01:00
#[cfg(unix)]
return 1;
#[cfg(not(unix))]
return 2;
2016-11-20 10:15:40 +09:00
}
#[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();
}