rust/tests/ui/crashes/returns.rs
Philipp Hansch b545f1c3bb
Add missing // run-pass annotations to ICE tests
compiletest UI tests do not fail when encountering panics and ICEs
unless the `// run-pass` flag is used.

(This was forgotten in https://github.com/rust-lang/rust-clippy/pull/3743)
2019-04-05 07:22:36 +02:00

26 lines
380 B
Rust

// run-pass
/// 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();
}