]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / checked_unwrap / complex_conditionals_nested.rs
CommitLineData
f20569fa 1#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
fe692bf9
FG
2#![allow(
3 clippy::if_same_then_else,
4 clippy::branches_sharing_code,
5 clippy::unnecessary_literal_unwrap
6)]
781aab86 7//@no-rustfix
f20569fa
XL
8fn test_nested() {
9 fn nested() {
10 let x = Some(());
11 if x.is_some() {
781aab86
FG
12 // unnecessary
13 x.unwrap();
14 //~^ ERROR: called `unwrap` on `x` after checking its variant with `is_some`
f20569fa 15 } else {
781aab86
FG
16 // will panic
17 x.unwrap();
18 //~^ ERROR: this call to `unwrap()` will always panic
f20569fa
XL
19 }
20 }
21}
22
23fn main() {}