]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/redundant_pattern_matching_drop_order.rs
Rollup merge of #100076 - tspiteri:const_slice_split_at, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / redundant_pattern_matching_drop_order.rs
1 // run-rustfix
2
3 // Issue #5746
4 #![warn(clippy::redundant_pattern_matching)]
5 #![allow(clippy::if_same_then_else, clippy::equatable_if_let)]
6 use std::task::Poll::{Pending, Ready};
7
8 fn main() {
9     let m = std::sync::Mutex::new((0, 0));
10
11     // Result
12     if let Ok(_) = m.lock() {}
13     if let Err(_) = Err::<(), _>(m.lock().unwrap().0) {}
14
15     {
16         if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {}
17     }
18     if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {
19     } else {
20     }
21     if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {}
22     if let Err(_) = Err::<std::sync::MutexGuard<()>, _>(()) {}
23
24     if let Ok(_) = Ok::<_, ()>(String::new()) {}
25     if let Err(_) = Err::<(), _>((String::new(), ())) {}
26
27     // Option
28     if let Some(_) = Some(m.lock()) {}
29     if let Some(_) = Some(m.lock().unwrap().0) {}
30
31     {
32         if let None = None::<std::sync::MutexGuard<()>> {}
33     }
34     if let None = None::<std::sync::MutexGuard<()>> {
35     } else {
36     }
37
38     if let None = None::<std::sync::MutexGuard<()>> {}
39
40     if let Some(_) = Some(String::new()) {}
41     if let Some(_) = Some((String::new(), ())) {}
42
43     // Poll
44     if let Ready(_) = Ready(m.lock()) {}
45     if let Ready(_) = Ready(m.lock().unwrap().0) {}
46
47     {
48         if let Pending = Pending::<std::sync::MutexGuard<()>> {}
49     }
50     if let Pending = Pending::<std::sync::MutexGuard<()>> {
51     } else {
52     }
53
54     if let Pending = Pending::<std::sync::MutexGuard<()>> {}
55
56     if let Ready(_) = Ready(String::new()) {}
57     if let Ready(_) = Ready((String::new(), ())) {}
58 }