1
1
error: redundant clone
2
- --> tests/ui/unnecessary_to_owned.rs:225 :64
2
+ --> tests/ui/unnecessary_to_owned.rs:217 :64
3
3
|
4
4
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
5
5
| ^^^^^^^^^^^ help: remove this
6
6
|
7
7
note: this value is dropped without further use
8
- --> tests/ui/unnecessary_to_owned.rs:225 :20
8
+ --> tests/ui/unnecessary_to_owned.rs:217 :20
9
9
|
10
10
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
12
= note: `-D clippy::redundant-clone` implied by `-D warnings`
13
13
= help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
14
14
15
15
error: redundant clone
16
- --> tests/ui/unnecessary_to_owned.rs:227 :40
16
+ --> tests/ui/unnecessary_to_owned.rs:219 :40
17
17
|
18
18
LL | require_os_str(&OsString::from("x").to_os_string());
19
19
| ^^^^^^^^^^^^^^^ help: remove this
20
20
|
21
21
note: this value is dropped without further use
22
- --> tests/ui/unnecessary_to_owned.rs:227 :21
22
+ --> tests/ui/unnecessary_to_owned.rs:219 :21
23
23
|
24
24
LL | require_os_str(&OsString::from("x").to_os_string());
25
25
| ^^^^^^^^^^^^^^^^^^^
26
26
27
27
error: redundant clone
28
- --> tests/ui/unnecessary_to_owned.rs:229 :48
28
+ --> tests/ui/unnecessary_to_owned.rs:221 :48
29
29
|
30
30
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
31
31
| ^^^^^^^^^^^^^^ help: remove this
32
32
|
33
33
note: this value is dropped without further use
34
- --> tests/ui/unnecessary_to_owned.rs:229 :19
34
+ --> tests/ui/unnecessary_to_owned.rs:221 :19
35
35
|
36
36
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
37
37
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
38
39
39
error: redundant clone
40
- --> tests/ui/unnecessary_to_owned.rs:231 :35
40
+ --> tests/ui/unnecessary_to_owned.rs:223 :35
41
41
|
42
42
LL | require_str(&String::from("x").to_string());
43
43
| ^^^^^^^^^^^^ help: remove this
44
44
|
45
45
note: this value is dropped without further use
46
- --> tests/ui/unnecessary_to_owned.rs:231 :18
46
+ --> tests/ui/unnecessary_to_owned.rs:223 :18
47
47
|
48
48
LL | require_str(&String::from("x").to_string());
49
49
| ^^^^^^^^^^^^^^^^^
50
50
51
51
error: redundant clone
52
- --> tests/ui/unnecessary_to_owned.rs:233 :39
52
+ --> tests/ui/unnecessary_to_owned.rs:225 :39
53
53
|
54
54
LL | require_slice(&[String::from("x")].to_owned());
55
55
| ^^^^^^^^^^^ help: remove this
56
56
|
57
57
note: this value is dropped without further use
58
- --> tests/ui/unnecessary_to_owned.rs:233 :20
58
+ --> tests/ui/unnecessary_to_owned.rs:225 :20
59
59
|
60
60
LL | require_slice(&[String::from("x")].to_owned());
61
61
| ^^^^^^^^^^^^^^^^^^^
@@ -442,43 +442,19 @@ LL | let _ = slice.to_owned().into_iter();
442
442
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
443
443
444
444
error: unnecessary use of `to_vec`
445
- --> tests/ui/unnecessary_to_owned.rs:198:13
446
- |
447
- LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter();
448
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
449
-
450
- error: unnecessary use of `to_owned`
451
- --> tests/ui/unnecessary_to_owned.rs:200:13
452
- |
453
- LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter();
454
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
455
-
456
- error: unnecessary use of `to_vec`
457
- --> tests/ui/unnecessary_to_owned.rs:203:13
445
+ --> tests/ui/unnecessary_to_owned.rs:199:13
458
446
|
459
447
LL | let _ = IntoIterator::into_iter(slice.to_vec());
460
448
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
461
449
462
450
error: unnecessary use of `to_owned`
463
- --> tests/ui/unnecessary_to_owned.rs:205 :13
451
+ --> tests/ui/unnecessary_to_owned.rs:201 :13
464
452
|
465
453
LL | let _ = IntoIterator::into_iter(slice.to_owned());
466
454
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
467
455
468
- error: unnecessary use of `to_vec`
469
- --> tests/ui/unnecessary_to_owned.rs:207:13
470
- |
471
- LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec());
472
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
473
-
474
- error: unnecessary use of `to_owned`
475
- --> tests/ui/unnecessary_to_owned.rs:209:13
476
- |
477
- LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned());
478
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
479
-
480
456
error: allocating a new `String` only to create a temporary `&str` from it
481
- --> tests/ui/unnecessary_to_owned.rs:237 :26
457
+ --> tests/ui/unnecessary_to_owned.rs:229 :26
482
458
|
483
459
LL | let _ref_str: &str = &String::from_utf8(slice.to_vec()).expect("not UTF-8");
484
460
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -490,7 +466,7 @@ LL + let _ref_str: &str = core::str::from_utf8(&slice).expect("not UTF-8");
490
466
|
491
467
492
468
error: allocating a new `String` only to create a temporary `&str` from it
493
- --> tests/ui/unnecessary_to_owned.rs:239 :26
469
+ --> tests/ui/unnecessary_to_owned.rs:231 :26
494
470
|
495
471
LL | let _ref_str: &str = &String::from_utf8(b"foo".to_vec()).unwrap();
496
472
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -502,7 +478,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo").unwrap();
502
478
|
503
479
504
480
error: allocating a new `String` only to create a temporary `&str` from it
505
- --> tests/ui/unnecessary_to_owned.rs:241 :26
481
+ --> tests/ui/unnecessary_to_owned.rs:233 :26
506
482
|
507
483
LL | let _ref_str: &str = &String::from_utf8(b"foo".as_slice().to_owned()).unwrap();
508
484
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -514,7 +490,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo".as_slice()).unwrap();
514
490
|
515
491
516
492
error: unnecessary use of `to_vec`
517
- --> tests/ui/unnecessary_to_owned.rs:299 :14
493
+ --> tests/ui/unnecessary_to_owned.rs:291 :14
518
494
|
519
495
LL | for t in file_types.to_vec() {
520
496
| ^^^^^^^^^^^^^^^^^^^
@@ -526,65 +502,53 @@ LL |
526
502
LL ~ let path = match get_file_path(t) {
527
503
|
528
504
529
- error: unnecessary use of `to_vec`
530
- --> tests/ui/unnecessary_to_owned.rs:323:14
531
- |
532
- LL | let _ = &["x"][..].to_vec().into_iter();
533
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
534
-
535
- error: unnecessary use of `to_vec`
536
- --> tests/ui/unnecessary_to_owned.rs:329:14
537
- |
538
- LL | let _ = &["x"][..].to_vec().into_iter();
539
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
540
-
541
505
error: unnecessary use of `to_string`
542
- --> tests/ui/unnecessary_to_owned.rs:378 :24
506
+ --> tests/ui/unnecessary_to_owned.rs:357 :24
543
507
|
544
508
LL | Box::new(build(y.to_string()))
545
509
| ^^^^^^^^^^^^^ help: use: `y`
546
510
547
511
error: unnecessary use of `to_string`
548
- --> tests/ui/unnecessary_to_owned.rs:488 :12
512
+ --> tests/ui/unnecessary_to_owned.rs:467 :12
549
513
|
550
514
LL | id("abc".to_string())
551
515
| ^^^^^^^^^^^^^^^^^ help: use: `"abc"`
552
516
553
517
error: unnecessary use of `to_vec`
554
- --> tests/ui/unnecessary_to_owned.rs:632 :37
518
+ --> tests/ui/unnecessary_to_owned.rs:611 :37
555
519
|
556
520
LL | IntoFuture::into_future(foo([].to_vec(), &0));
557
521
| ^^^^^^^^^^^ help: use: `[]`
558
522
559
523
error: unnecessary use of `to_vec`
560
- --> tests/ui/unnecessary_to_owned.rs:643 :18
524
+ --> tests/ui/unnecessary_to_owned.rs:622 :18
561
525
|
562
526
LL | s.remove(&a.to_vec());
563
527
| ^^^^^^^^^^^ help: replace it with: `a`
564
528
565
529
error: unnecessary use of `to_owned`
566
- --> tests/ui/unnecessary_to_owned.rs:648 :14
530
+ --> tests/ui/unnecessary_to_owned.rs:627 :14
567
531
|
568
532
LL | s.remove(&"b".to_owned());
569
533
| ^^^^^^^^^^^^^^^ help: replace it with: `"b"`
570
534
571
535
error: unnecessary use of `to_string`
572
- --> tests/ui/unnecessary_to_owned.rs:650 :14
536
+ --> tests/ui/unnecessary_to_owned.rs:629 :14
573
537
|
574
538
LL | s.remove(&"b".to_string());
575
539
| ^^^^^^^^^^^^^^^^ help: replace it with: `"b"`
576
540
577
541
error: unnecessary use of `to_vec`
578
- --> tests/ui/unnecessary_to_owned.rs:656 :14
542
+ --> tests/ui/unnecessary_to_owned.rs:635 :14
579
543
|
580
544
LL | s.remove(&["b"].to_vec());
581
545
| ^^^^^^^^^^^^^^^ help: replace it with: `["b"].as_slice()`
582
546
583
547
error: unnecessary use of `to_vec`
584
- --> tests/ui/unnecessary_to_owned.rs:658 :14
548
+ --> tests/ui/unnecessary_to_owned.rs:637 :14
585
549
|
586
550
LL | s.remove(&(&["b"]).to_vec());
587
551
| ^^^^^^^^^^^^^^^^^^ help: replace it with: `(&["b"]).as_slice()`
588
552
589
- error: aborting due to 88 previous errors
553
+ error: aborting due to 82 previous errors
590
554
0 commit comments