Skip to content

Commit cc9d96c

Browse files
committed
precommit test
1 parent c943f4c commit cc9d96c

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

tests/ui/or_fun_call.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ mod issue8993 {
283283
let _ = Some(4).map_or_else(g, f);
284284
//~^ or_fun_call
285285
let _ = Some(4).map_or(0, f);
286+
let _ = Some(4).map_or("asd".to_string().len() as i32, f);
286287
}
287288
}
288289

@@ -426,6 +427,7 @@ mod result_map_or {
426427
let _ = x.map_or_else(|_| g(), f);
427428
//~^ or_fun_call
428429
let _ = x.map_or(0, f);
430+
let _ = x.map_or("asd".to_string().len() as i32, f);
429431
}
430432
}
431433

tests/ui/or_fun_call.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ mod issue8993 {
283283
let _ = Some(4).map_or(g(), f);
284284
//~^ or_fun_call
285285
let _ = Some(4).map_or(0, f);
286+
let _ = Some(4).map_or("asd".to_string().len() as i32, f);
286287
}
287288
}
288289

@@ -426,6 +427,7 @@ mod result_map_or {
426427
let _ = x.map_or(g(), f);
427428
//~^ or_fun_call
428429
let _ = x.map_or(0, f);
430+
let _ = x.map_or("asd".to_string().len() as i32, f);
429431
}
430432
}
431433

tests/ui/or_fun_call.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,61 +155,61 @@ LL | let _ = Some(4).map_or(g(), f);
155155
| ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)`
156156

157157
error: use of `unwrap_or_else` to construct default value
158-
--> tests/ui/or_fun_call.rs:315:18
158+
--> tests/ui/or_fun_call.rs:316:18
159159
|
160160
LL | with_new.unwrap_or_else(Vec::new);
161161
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
162162

163163
error: use of `unwrap_or_else` to construct default value
164-
--> tests/ui/or_fun_call.rs:319:28
164+
--> tests/ui/or_fun_call.rs:320:28
165165
|
166166
LL | with_default_trait.unwrap_or_else(Default::default);
167167
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
168168

169169
error: use of `unwrap_or_else` to construct default value
170-
--> tests/ui/or_fun_call.rs:323:27
170+
--> tests/ui/or_fun_call.rs:324:27
171171
|
172172
LL | with_default_type.unwrap_or_else(u64::default);
173173
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
174174

175175
error: use of `unwrap_or_else` to construct default value
176-
--> tests/ui/or_fun_call.rs:327:22
176+
--> tests/ui/or_fun_call.rs:328:22
177177
|
178178
LL | real_default.unwrap_or_else(<FakeDefault as Default>::default);
179179
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
180180

181181
error: use of `or_insert_with` to construct default value
182-
--> tests/ui/or_fun_call.rs:331:23
182+
--> tests/ui/or_fun_call.rs:332:23
183183
|
184184
LL | map.entry(42).or_insert_with(String::new);
185185
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
186186

187187
error: use of `or_insert_with` to construct default value
188-
--> tests/ui/or_fun_call.rs:335:25
188+
--> tests/ui/or_fun_call.rs:336:25
189189
|
190190
LL | btree.entry(42).or_insert_with(String::new);
191191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
192192

193193
error: use of `unwrap_or_else` to construct default value
194-
--> tests/ui/or_fun_call.rs:339:25
194+
--> tests/ui/or_fun_call.rs:340:25
195195
|
196196
LL | let _ = stringy.unwrap_or_else(String::new);
197197
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
198198

199199
error: function call inside of `unwrap_or`
200-
--> tests/ui/or_fun_call.rs:381:17
200+
--> tests/ui/or_fun_call.rs:382:17
201201
|
202202
LL | let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)`
203203
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)`
204204

205205
error: function call inside of `unwrap_or`
206-
--> tests/ui/or_fun_call.rs:386:17
206+
--> tests/ui/or_fun_call.rs:387:17
207207
|
208208
LL | let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)`
209209
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)`
210210

211211
error: function call inside of `unwrap_or`
212-
--> tests/ui/or_fun_call.rs:391:17
212+
--> tests/ui/or_fun_call.rs:392:17
213213
|
214214
LL | let _ = opt.unwrap_or({
215215
| _________________^
@@ -229,49 +229,49 @@ LL ~ });
229229
|
230230

231231
error: function call inside of `map_or`
232-
--> tests/ui/or_fun_call.rs:397:17
232+
--> tests/ui/or_fun_call.rs:398:17
233233
|
234234
LL | let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)`
235235
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| f() + 1, |v| v)`
236236

237237
error: use of `unwrap_or` to construct default value
238-
--> tests/ui/or_fun_call.rs:402:17
238+
--> tests/ui/or_fun_call.rs:403:17
239239
|
240240
LL | let _ = opt.unwrap_or({ i32::default() });
241241
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
242242

243243
error: function call inside of `unwrap_or`
244-
--> tests/ui/or_fun_call.rs:409:21
244+
--> tests/ui/or_fun_call.rs:410:21
245245
|
246246
LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() });
247247
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })`
248248

249249
error: function call inside of `map_or`
250-
--> tests/ui/or_fun_call.rs:424:19
250+
--> tests/ui/or_fun_call.rs:425:19
251251
|
252252
LL | let _ = x.map_or(g(), |v| v);
253253
| ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), |v| v)`
254254

255255
error: function call inside of `map_or`
256-
--> tests/ui/or_fun_call.rs:426:19
256+
--> tests/ui/or_fun_call.rs:427:19
257257
|
258258
LL | let _ = x.map_or(g(), f);
259259
| ^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), f)`
260260

261261
error: function call inside of `get_or_insert`
262-
--> tests/ui/or_fun_call.rs:438:15
262+
--> tests/ui/or_fun_call.rs:440:15
263263
|
264264
LL | let _ = x.get_or_insert(g());
265265
| ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)`
266266

267267
error: function call inside of `and`
268-
--> tests/ui/or_fun_call.rs:448:15
268+
--> tests/ui/or_fun_call.rs:450:15
269269
|
270270
LL | let _ = x.and(g());
271271
| ^^^^^^^^ help: try: `and_then(|_| g())`
272272

273273
error: function call inside of `and`
274-
--> tests/ui/or_fun_call.rs:458:15
274+
--> tests/ui/or_fun_call.rs:460:15
275275
|
276276
LL | let _ = x.and(g());
277277
| ^^^^^^^^ help: try: `and_then(|_| g())`

0 commit comments

Comments
 (0)