11error: redundant clone
2- --> tests/ui/unnecessary_to_owned.rs:225 :64
2+ --> tests/ui/unnecessary_to_owned.rs:217 :64
33 |
44LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
55 | ^^^^^^^^^^^ help: remove this
66 |
77note: 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
99 |
1010LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212 = note: `-D clippy::redundant-clone` implied by `-D warnings`
1313 = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
1414
1515error: redundant clone
16- --> tests/ui/unnecessary_to_owned.rs:227 :40
16+ --> tests/ui/unnecessary_to_owned.rs:219 :40
1717 |
1818LL | require_os_str(&OsString::from("x").to_os_string());
1919 | ^^^^^^^^^^^^^^^ help: remove this
2020 |
2121note: 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
2323 |
2424LL | require_os_str(&OsString::from("x").to_os_string());
2525 | ^^^^^^^^^^^^^^^^^^^
2626
2727error: redundant clone
28- --> tests/ui/unnecessary_to_owned.rs:229 :48
28+ --> tests/ui/unnecessary_to_owned.rs:221 :48
2929 |
3030LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
3131 | ^^^^^^^^^^^^^^ help: remove this
3232 |
3333note: 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
3535 |
3636LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
3737 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838
3939error: redundant clone
40- --> tests/ui/unnecessary_to_owned.rs:231 :35
40+ --> tests/ui/unnecessary_to_owned.rs:223 :35
4141 |
4242LL | require_str(&String::from("x").to_string());
4343 | ^^^^^^^^^^^^ help: remove this
4444 |
4545note: 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
4747 |
4848LL | require_str(&String::from("x").to_string());
4949 | ^^^^^^^^^^^^^^^^^
5050
5151error: redundant clone
52- --> tests/ui/unnecessary_to_owned.rs:233 :39
52+ --> tests/ui/unnecessary_to_owned.rs:225 :39
5353 |
5454LL | require_slice(&[String::from("x")].to_owned());
5555 | ^^^^^^^^^^^ help: remove this
5656 |
5757note: 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
5959 |
6060LL | require_slice(&[String::from("x")].to_owned());
6161 | ^^^^^^^^^^^^^^^^^^^
@@ -442,43 +442,19 @@ LL | let _ = slice.to_owned().into_iter();
442442 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
443443
444444error: 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
458446 |
459447LL | let _ = IntoIterator::into_iter(slice.to_vec());
460448 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
461449
462450error: unnecessary use of `to_owned`
463- --> tests/ui/unnecessary_to_owned.rs:205 :13
451+ --> tests/ui/unnecessary_to_owned.rs:201 :13
464452 |
465453LL | let _ = IntoIterator::into_iter(slice.to_owned());
466454 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
467455
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-
480456error: 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
482458 |
483459LL | let _ref_str: &str = &String::from_utf8(slice.to_vec()).expect("not UTF-8");
484460 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -490,7 +466,7 @@ LL + let _ref_str: &str = core::str::from_utf8(&slice).expect("not UTF-8");
490466 |
491467
492468error: 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
494470 |
495471LL | let _ref_str: &str = &String::from_utf8(b"foo".to_vec()).unwrap();
496472 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -502,7 +478,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo").unwrap();
502478 |
503479
504480error: 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
506482 |
507483LL | let _ref_str: &str = &String::from_utf8(b"foo".as_slice().to_owned()).unwrap();
508484 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -514,7 +490,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo".as_slice()).unwrap();
514490 |
515491
516492error: unnecessary use of `to_vec`
517- --> tests/ui/unnecessary_to_owned.rs:299 :14
493+ --> tests/ui/unnecessary_to_owned.rs:291 :14
518494 |
519495LL | for t in file_types.to_vec() {
520496 | ^^^^^^^^^^^^^^^^^^^
@@ -526,65 +502,53 @@ LL |
526502LL ~ let path = match get_file_path(t) {
527503 |
528504
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-
541505error: unnecessary use of `to_string`
542- --> tests/ui/unnecessary_to_owned.rs:378 :24
506+ --> tests/ui/unnecessary_to_owned.rs:357 :24
543507 |
544508LL | Box::new(build(y.to_string()))
545509 | ^^^^^^^^^^^^^ help: use: `y`
546510
547511error: unnecessary use of `to_string`
548- --> tests/ui/unnecessary_to_owned.rs:488 :12
512+ --> tests/ui/unnecessary_to_owned.rs:467 :12
549513 |
550514LL | id("abc".to_string())
551515 | ^^^^^^^^^^^^^^^^^ help: use: `"abc"`
552516
553517error: unnecessary use of `to_vec`
554- --> tests/ui/unnecessary_to_owned.rs:632 :37
518+ --> tests/ui/unnecessary_to_owned.rs:611 :37
555519 |
556520LL | IntoFuture::into_future(foo([].to_vec(), &0));
557521 | ^^^^^^^^^^^ help: use: `[]`
558522
559523error: unnecessary use of `to_vec`
560- --> tests/ui/unnecessary_to_owned.rs:643 :18
524+ --> tests/ui/unnecessary_to_owned.rs:622 :18
561525 |
562526LL | s.remove(&a.to_vec());
563527 | ^^^^^^^^^^^ help: replace it with: `a`
564528
565529error: unnecessary use of `to_owned`
566- --> tests/ui/unnecessary_to_owned.rs:648 :14
530+ --> tests/ui/unnecessary_to_owned.rs:627 :14
567531 |
568532LL | s.remove(&"b".to_owned());
569533 | ^^^^^^^^^^^^^^^ help: replace it with: `"b"`
570534
571535error: unnecessary use of `to_string`
572- --> tests/ui/unnecessary_to_owned.rs:650 :14
536+ --> tests/ui/unnecessary_to_owned.rs:629 :14
573537 |
574538LL | s.remove(&"b".to_string());
575539 | ^^^^^^^^^^^^^^^^ help: replace it with: `"b"`
576540
577541error: unnecessary use of `to_vec`
578- --> tests/ui/unnecessary_to_owned.rs:656 :14
542+ --> tests/ui/unnecessary_to_owned.rs:635 :14
579543 |
580544LL | s.remove(&["b"].to_vec());
581545 | ^^^^^^^^^^^^^^^ help: replace it with: `["b"].as_slice()`
582546
583547error: unnecessary use of `to_vec`
584- --> tests/ui/unnecessary_to_owned.rs:658 :14
548+ --> tests/ui/unnecessary_to_owned.rs:637 :14
585549 |
586550LL | s.remove(&(&["b"]).to_vec());
587551 | ^^^^^^^^^^^^^^^^^^ help: replace it with: `(&["b"]).as_slice()`
588552
589- error: aborting due to 88 previous errors
553+ error: aborting due to 82 previous errors
590554
0 commit comments