]> git.lizzy.rs Git - rust.git/blob - tests/ui/crashes/returns.rs
Rollup merge of #5410 - dtolnay:trivially, r=flip1995
[rust.git] / tests / ui / crashes / returns.rs
1 // run-pass
2
3 /// Test for https://github.com/rust-lang/rust-clippy/issues/1346
4
5 #[deny(warnings)]
6 fn cfg_return() -> i32 {
7     #[cfg(unix)]
8     return 1;
9     #[cfg(not(unix))]
10     return 2;
11 }
12
13 #[deny(warnings)]
14 fn cfg_let_and_return() -> i32 {
15     #[cfg(unix)]
16     let x = 1;
17     #[cfg(not(unix))]
18     let x = 2;
19     x
20 }
21
22 fn main() {
23     cfg_return();
24     cfg_let_and_return();
25 }