rust-clippy/tests/run-pass/returns.rs

22 lines
300 B
Rust
Raw Normal View History

2016-11-20 01:15:40 +00:00
#[deny(warnings)]
fn cfg_return() -> i32 {
2018-12-09 22:26:16 +00:00
#[cfg(unix)]
return 1;
#[cfg(not(unix))]
return 2;
2016-11-20 01:15:40 +00: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();
}