]> git.lizzy.rs Git - rust.git/blob - tests/ui/redundant_pattern_matching_option.stderr
Improve `redundant_pattern_matching`
[rust.git] / tests / ui / redundant_pattern_matching_option.stderr
1 error: redundant pattern matching, consider using `is_none()`
2   --> $DIR/redundant_pattern_matching_option.rs:13:12
3    |
4 LL |     if let None = None::<()> {}
5    |     -------^^^^------------- help: try this: `if None::<()>.is_none()`
6    |
7    = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
8
9 error: redundant pattern matching, consider using `is_some()`
10   --> $DIR/redundant_pattern_matching_option.rs:15:12
11    |
12 LL |     if let Some(_) = Some(42) {}
13    |     -------^^^^^^^----------- help: try this: `if Some(42).is_some()`
14
15 error: redundant pattern matching, consider using `is_some()`
16   --> $DIR/redundant_pattern_matching_option.rs:17:12
17    |
18 LL |     if let Some(_) = Some(42) {
19    |     -------^^^^^^^----------- help: try this: `if Some(42).is_some()`
20
21 error: redundant pattern matching, consider using `is_some()`
22   --> $DIR/redundant_pattern_matching_option.rs:23:15
23    |
24 LL |     while let Some(_) = Some(42) {}
25    |     ----------^^^^^^^----------- help: try this: `while Some(42).is_some()`
26
27 error: redundant pattern matching, consider using `is_none()`
28   --> $DIR/redundant_pattern_matching_option.rs:25:15
29    |
30 LL |     while let None = Some(42) {}
31    |     ----------^^^^----------- help: try this: `while Some(42).is_none()`
32
33 error: redundant pattern matching, consider using `is_none()`
34   --> $DIR/redundant_pattern_matching_option.rs:27:15
35    |
36 LL |     while let None = None::<()> {}
37    |     ----------^^^^------------- help: try this: `while None::<()>.is_none()`
38
39 error: redundant pattern matching, consider using `is_some()`
40   --> $DIR/redundant_pattern_matching_option.rs:30:15
41    |
42 LL |     while let Some(_) = v.pop() {
43    |     ----------^^^^^^^---------- help: try this: `while v.pop().is_some()`
44
45 error: redundant pattern matching, consider using `is_some()`
46   --> $DIR/redundant_pattern_matching_option.rs:38:5
47    |
48 LL | /     match Some(42) {
49 LL | |         Some(_) => true,
50 LL | |         None => false,
51 LL | |     };
52    | |_____^ help: try this: `Some(42).is_some()`
53
54 error: redundant pattern matching, consider using `is_none()`
55   --> $DIR/redundant_pattern_matching_option.rs:43:5
56    |
57 LL | /     match None::<()> {
58 LL | |         Some(_) => false,
59 LL | |         None => true,
60 LL | |     };
61    | |_____^ help: try this: `None::<()>.is_none()`
62
63 error: redundant pattern matching, consider using `is_none()`
64   --> $DIR/redundant_pattern_matching_option.rs:48:13
65    |
66 LL |       let _ = match None::<()> {
67    |  _____________^
68 LL | |         Some(_) => false,
69 LL | |         None => true,
70 LL | |     };
71    | |_____^ help: try this: `None::<()>.is_none()`
72
73 error: redundant pattern matching, consider using `is_some()`
74   --> $DIR/redundant_pattern_matching_option.rs:54:20
75    |
76 LL |     let _ = if let Some(_) = opt { true } else { false };
77    |             -------^^^^^^^------ help: try this: `if opt.is_some()`
78
79 error: redundant pattern matching, consider using `is_some()`
80   --> $DIR/redundant_pattern_matching_option.rs:58:20
81    |
82 LL |     let _ = if let Some(_) = gen_opt() {
83    |             -------^^^^^^^------------ help: try this: `if gen_opt().is_some()`
84
85 error: redundant pattern matching, consider using `is_none()`
86   --> $DIR/redundant_pattern_matching_option.rs:60:19
87    |
88 LL |     } else if let None = gen_opt() {
89    |            -------^^^^------------ help: try this: `if gen_opt().is_none()`
90
91 error: redundant pattern matching, consider using `is_some()`
92   --> $DIR/redundant_pattern_matching_option.rs:79:12
93    |
94 LL |     if let Some(_) = Some(42) {}
95    |     -------^^^^^^^----------- help: try this: `if Some(42).is_some()`
96
97 error: redundant pattern matching, consider using `is_none()`
98   --> $DIR/redundant_pattern_matching_option.rs:81:12
99    |
100 LL |     if let None = None::<()> {}
101    |     -------^^^^------------- help: try this: `if None::<()>.is_none()`
102
103 error: redundant pattern matching, consider using `is_some()`
104   --> $DIR/redundant_pattern_matching_option.rs:83:15
105    |
106 LL |     while let Some(_) = Some(42) {}
107    |     ----------^^^^^^^----------- help: try this: `while Some(42).is_some()`
108
109 error: redundant pattern matching, consider using `is_none()`
110   --> $DIR/redundant_pattern_matching_option.rs:85:15
111    |
112 LL |     while let None = None::<()> {}
113    |     ----------^^^^------------- help: try this: `while None::<()>.is_none()`
114
115 error: redundant pattern matching, consider using `is_some()`
116   --> $DIR/redundant_pattern_matching_option.rs:87:5
117    |
118 LL | /     match Some(42) {
119 LL | |         Some(_) => true,
120 LL | |         None => false,
121 LL | |     };
122    | |_____^ help: try this: `Some(42).is_some()`
123
124 error: redundant pattern matching, consider using `is_none()`
125   --> $DIR/redundant_pattern_matching_option.rs:92:5
126    |
127 LL | /     match None::<()> {
128 LL | |         Some(_) => false,
129 LL | |         None => true,
130 LL | |     };
131    | |_____^ help: try this: `None::<()>.is_none()`
132
133 error: aborting due to 19 previous errors
134