rust/tests/ui/checked_unwrap/complex_conditionals_nested.rs

16 lines
349 B
Rust
Raw Normal View History

2020-03-18 09:24:48 -05:00
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![allow(clippy::if_same_then_else, clippy::shared_code_in_if_blocks)]
2020-03-18 09:24:48 -05:00
fn test_nested() {
fn nested() {
let x = Some(());
if x.is_some() {
x.unwrap(); // unnecessary
} else {
x.unwrap(); // will panic
}
}
}
fn main() {}