rust-clippy/tests/ui/crashes/if_same_then_else.rs

19 lines
331 B
Rust
Raw Normal View History

// run-pass
2019-09-24 21:55:05 +00:00
#![allow(clippy::comparison_chain)]
2018-07-30 09:33:44 +00:00
#![deny(clippy::if_same_then_else)]
/// Test for https://github.com/rust-lang/rust-clippy/issues/2426
fn main() {}
pub fn foo(a: i32, b: i32) -> Option<&'static str> {
if a == b {
None
} else if a > b {
Some("a pfeil b")
} else {
None
}
}