rust-clippy/tests/ui/checked_unwrap/complex_conditionals_nested.rs

20 lines
396 B
Rust
Raw Normal View History

2020-03-18 14:24:48 +00:00
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
2023-05-31 17:47:10 +00:00
#![allow(
clippy::if_same_then_else,
clippy::branches_sharing_code,
clippy::unnecessary_literal_unwrap
)]
2020-03-18 14:24:48 +00:00
fn test_nested() {
fn nested() {
let x = Some(());
if x.is_some() {
x.unwrap(); // unnecessary
} else {
x.unwrap(); // will panic
}
}
}
fn main() {}