about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.rs
blob: 7635f848cb349b8a8aaa2945fbaf651de6459c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![allow(
    clippy::if_same_then_else,
    clippy::branches_sharing_code,
    clippy::unnecessary_literal_unwrap
)]
//@no-rustfix: has placeholders
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() {}