Skip to content

Commit c53ceba

Browse files
committed
update tests
1 parent 3991dd1 commit c53ceba

3 files changed

+30
-22
lines changed

Diff for: tests/ui/redundant_pattern_matching_option.fixed

+9-5
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,19 @@ fn issue7921() {
9191
}
9292

9393
fn issue10726() {
94-
Some(42).is_some();
94+
let x = Some(42);
95+
let y = None::<()>;
9596

96-
Some(42).is_none();
97+
x.is_some();
9798

98-
None::<()>.is_some();
99+
x.is_none();
99100

100-
None::<()>.is_none();
101+
y.is_some();
102+
103+
y.is_none();
101104

102-
match Some(42) {
105+
// Don't lint
106+
match x {
103107
Some(21) => true,
104108
_ => false,
105109
};

Diff for: tests/ui/redundant_pattern_matching_option.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,31 @@ fn issue7921() {
106106
}
107107

108108
fn issue10726() {
109-
match Some(42) {
109+
let x = Some(42);
110+
let y = None::<()>;
111+
112+
match x {
110113
Some(_) => true,
111114
_ => false,
112115
};
113116

114-
match Some(42) {
117+
match x {
115118
None => true,
116119
_ => false,
117120
};
118121

119-
match None::<()> {
122+
match y {
120123
Some(_) => true,
121124
_ => false,
122125
};
123126

124-
match None::<()> {
127+
match y {
125128
None => true,
126129
_ => false,
127130
};
128131

129-
match Some(42) {
132+
// Don't lint
133+
match x {
130134
Some(21) => true,
131135
_ => false,
132136
};

Diff for: tests/ui/redundant_pattern_matching_option.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -149,40 +149,40 @@ LL | if let None = *&None::<()> {}
149149
| -------^^^^--------------- help: try this: `if (&None::<()>).is_none()`
150150

151151
error: redundant pattern matching, consider using `is_some()`
152-
--> $DIR/redundant_pattern_matching_option.rs:109:5
152+
--> $DIR/redundant_pattern_matching_option.rs:112:5
153153
|
154-
LL | / match Some(42) {
154+
LL | / match x {
155155
LL | | Some(_) => true,
156156
LL | | _ => false,
157157
LL | | };
158-
| |_____^ help: try this: `Some(42).is_some()`
158+
| |_____^ help: try this: `x.is_some()`
159159

160160
error: redundant pattern matching, consider using `is_none()`
161-
--> $DIR/redundant_pattern_matching_option.rs:114:5
161+
--> $DIR/redundant_pattern_matching_option.rs:117:5
162162
|
163-
LL | / match Some(42) {
163+
LL | / match x {
164164
LL | | None => true,
165165
LL | | _ => false,
166166
LL | | };
167-
| |_____^ help: try this: `Some(42).is_none()`
167+
| |_____^ help: try this: `x.is_none()`
168168

169169
error: redundant pattern matching, consider using `is_some()`
170-
--> $DIR/redundant_pattern_matching_option.rs:119:5
170+
--> $DIR/redundant_pattern_matching_option.rs:122:5
171171
|
172-
LL | / match None::<()> {
172+
LL | / match y {
173173
LL | | Some(_) => true,
174174
LL | | _ => false,
175175
LL | | };
176-
| |_____^ help: try this: `None::<()>.is_some()`
176+
| |_____^ help: try this: `y.is_some()`
177177

178178
error: redundant pattern matching, consider using `is_none()`
179-
--> $DIR/redundant_pattern_matching_option.rs:124:5
179+
--> $DIR/redundant_pattern_matching_option.rs:127:5
180180
|
181-
LL | / match None::<()> {
181+
LL | / match y {
182182
LL | | None => true,
183183
LL | | _ => false,
184184
LL | | };
185-
| |_____^ help: try this: `None::<()>.is_none()`
185+
| |_____^ help: try this: `y.is_none()`
186186

187187
error: aborting due to 26 previous errors
188188

0 commit comments

Comments
 (0)