Files
rust/tests/ui/checked_unwrap/complex_conditionals_nested.rs
Guillaume Gomez f666fd6417 Update UI tests
2025-02-15 13:38:16 +01:00

24 lines
503 B
Rust

#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![allow(
clippy::if_same_then_else,
clippy::branches_sharing_code,
clippy::unnecessary_literal_unwrap
)]
//@no-rustfix
fn test_nested() {
fn nested() {
let x = Some(());
if x.is_some() {
// unnecessary
x.unwrap();
//~^ unnecessary_unwrap
} else {
// will panic
x.unwrap();
//~^ panicking_unwrap
}
}
}
fn main() {}