@@ -318,13 +318,37 @@ error: unnecessary structure name repetition
318
318
263 | fn new() -> Foo { Foo }
319
319
| ^^^ help: use the applicable keyword: `Self`
320
320
321
+ error: use of `unwrap_or` followed by a function call
322
+ --> $DIR/methods.rs:281:5
323
+ |
324
+ 281 | with_constructor.unwrap_or(make());
325
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)`
326
+ |
327
+ = note: `-D or-fun-call` implied by `-D warnings`
328
+
321
329
error: use of `unwrap_or` followed by a call to `new`
322
330
--> $DIR/methods.rs:284:5
323
331
|
324
332
284 | with_new.unwrap_or(Vec::new());
325
333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
334
+
335
+ error: use of `unwrap_or` followed by a function call
336
+ --> $DIR/methods.rs:287:5
326
337
|
327
- = note: `-D or-fun-call` implied by `-D warnings`
338
+ 287 | with_const_args.unwrap_or(Vec::with_capacity(12));
339
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))`
340
+
341
+ error: use of `unwrap_or` followed by a function call
342
+ --> $DIR/methods.rs:290:5
343
+ |
344
+ 290 | with_err.unwrap_or(make());
345
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())`
346
+
347
+ error: use of `unwrap_or` followed by a function call
348
+ --> $DIR/methods.rs:293:5
349
+ |
350
+ 293 | with_err_args.unwrap_or(Vec::with_capacity(12));
351
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))`
328
352
329
353
error: use of `unwrap_or` followed by a call to `default`
330
354
--> $DIR/methods.rs:296:5
@@ -338,6 +362,36 @@ error: use of `unwrap_or` followed by a call to `default`
338
362
299 | with_default_type.unwrap_or(u64::default());
339
363
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
340
364
365
+ error: use of `unwrap_or` followed by a function call
366
+ --> $DIR/methods.rs:302:5
367
+ |
368
+ 302 | with_vec.unwrap_or(vec![]);
369
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))`
370
+
371
+ error: use of `unwrap_or` followed by a function call
372
+ --> $DIR/methods.rs:307:5
373
+ |
374
+ 307 | without_default.unwrap_or(Foo::new());
375
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)`
376
+
377
+ error: use of `or_insert` followed by a function call
378
+ --> $DIR/methods.rs:310:5
379
+ |
380
+ 310 | map.entry(42).or_insert(String::new());
381
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)`
382
+
383
+ error: use of `or_insert` followed by a function call
384
+ --> $DIR/methods.rs:313:5
385
+ |
386
+ 313 | btree.entry(42).or_insert(String::new());
387
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)`
388
+
389
+ error: use of `unwrap_or` followed by a function call
390
+ --> $DIR/methods.rs:316:13
391
+ |
392
+ 316 | let _ = stringy.unwrap_or("".to_owned());
393
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())`
394
+
341
395
error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
342
396
--> $DIR/methods.rs:327:23
343
397
|
0 commit comments