mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 09:27:25 +00:00
Auto merge of #8692 - kyoto7250:fixing_unnecessary_to_owned, r=giraffate
fix unnecessary_to_owned about msrv
This PR fixes ``[`unnecessary_owned`]``.
## What
```rust
# sample code
fn _msrv_1_35() {
#![clippy::msrv = "1.35"]
let _ = &["x"][..].to_vec().into_iter();
}
fn _msrv_1_36() {
#![clippy::msrv = "1.36"]
let _ = &["x"][..].to_vec().into_iter();
}
```
If we will check this code using clippy, ``[`unnecessary_owned`]`` will modify the code as follows.
```rust
error: unnecessary use of `to_vec`
--> $DIR/unnecessary_to_owned.rs:219:14
|
LL | let _ = &["x"][..].to_vec().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
error: unnecessary use of `to_vec`
--> $DIR/unnecessary_to_owned.rs:224:14
|
LL | let _ = &["x"][..].to_vec().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
```
This is incorrect. Because `Iterator::copied` was estabilished in 1.36.
## Why
This bug was caused by not separating "copied" and "clone" by reference to msrv.
89ee6aa6e3/clippy_lints/src/methods/unnecessary_to_owned.rs (L195)
So, I added a conditional branch and described the corresponding test.
Thank you in advance.
changelog: fix wrong suggestions about msrv in [`unnecessary_to_owned`]
r! `@giraffate`
This commit is contained in:
commit
f70c73f5c4
5 changed files with 148 additions and 97 deletions
|
@ -2286,7 +2286,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
||||||
single_char_add_str::check(cx, expr, args);
|
single_char_add_str::check(cx, expr, args);
|
||||||
into_iter_on_ref::check(cx, expr, method_span, method_call.ident.name, args);
|
into_iter_on_ref::check(cx, expr, method_span, method_call.ident.name, args);
|
||||||
single_char_pattern::check(cx, expr, method_call.ident.name, args);
|
single_char_pattern::check(cx, expr, method_call.ident.name, args);
|
||||||
unnecessary_to_owned::check(cx, expr, method_call.ident.name, args);
|
unnecessary_to_owned::check(cx, expr, method_call.ident.name, args, self.msrv.as_ref());
|
||||||
},
|
},
|
||||||
hir::ExprKind::Binary(op, lhs, rhs) if op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne => {
|
hir::ExprKind::Binary(op, lhs, rhs) if op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne => {
|
||||||
let mut info = BinaryExprInfo {
|
let mut info = BinaryExprInfo {
|
||||||
|
|
|
@ -5,6 +5,8 @@ use clippy_utils::source::snippet_opt;
|
||||||
use clippy_utils::ty::{
|
use clippy_utils::ty::{
|
||||||
contains_ty, get_associated_type, get_iterator_item_ty, implements_trait, is_copy, peel_mid_ty_refs,
|
contains_ty, get_associated_type, get_iterator_item_ty, implements_trait, is_copy, peel_mid_ty_refs,
|
||||||
};
|
};
|
||||||
|
use clippy_utils::{meets_msrv, msrvs};
|
||||||
|
|
||||||
use clippy_utils::{fn_def_id, get_parent_expr, is_diag_item_method, is_diag_trait_item};
|
use clippy_utils::{fn_def_id, get_parent_expr, is_diag_item_method, is_diag_trait_item};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::{def_id::DefId, BorrowKind, Expr, ExprKind};
|
use rustc_hir::{def_id::DefId, BorrowKind, Expr, ExprKind};
|
||||||
|
@ -13,12 +15,19 @@ use rustc_middle::mir::Mutability;
|
||||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref};
|
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref};
|
||||||
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
|
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
|
||||||
use rustc_middle::ty::{self, PredicateKind, ProjectionPredicate, TraitPredicate, Ty};
|
use rustc_middle::ty::{self, PredicateKind, ProjectionPredicate, TraitPredicate, Ty};
|
||||||
|
use rustc_semver::RustcVersion;
|
||||||
use rustc_span::{sym, Symbol};
|
use rustc_span::{sym, Symbol};
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
|
||||||
use super::UNNECESSARY_TO_OWNED;
|
use super::UNNECESSARY_TO_OWNED;
|
||||||
|
|
||||||
pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol, args: &'tcx [Expr<'tcx>]) {
|
pub fn check<'tcx>(
|
||||||
|
cx: &LateContext<'tcx>,
|
||||||
|
expr: &'tcx Expr<'tcx>,
|
||||||
|
method_name: Symbol,
|
||||||
|
args: &'tcx [Expr<'tcx>],
|
||||||
|
msrv: Option<&RustcVersion>,
|
||||||
|
) {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
if let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
||||||
if let [receiver] = args;
|
if let [receiver] = args;
|
||||||
|
@ -33,7 +42,7 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name:
|
||||||
if check_addr_of_expr(cx, expr, method_name, method_def_id, receiver) {
|
if check_addr_of_expr(cx, expr, method_name, method_def_id, receiver) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if check_into_iter_call_arg(cx, expr, method_name, receiver) {
|
if check_into_iter_call_arg(cx, expr, method_name, receiver, msrv) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
check_other_call_arg(cx, expr, method_name, receiver);
|
check_other_call_arg(cx, expr, method_name, receiver);
|
||||||
|
@ -178,7 +187,13 @@ fn check_addr_of_expr(
|
||||||
|
|
||||||
/// Checks whether `expr` is an argument in an `into_iter` call and, if so, determines whether its
|
/// Checks whether `expr` is an argument in an `into_iter` call and, if so, determines whether its
|
||||||
/// call of a `to_owned`-like function is unnecessary.
|
/// call of a `to_owned`-like function is unnecessary.
|
||||||
fn check_into_iter_call_arg(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol, receiver: &Expr<'_>) -> bool {
|
fn check_into_iter_call_arg(
|
||||||
|
cx: &LateContext<'_>,
|
||||||
|
expr: &Expr<'_>,
|
||||||
|
method_name: Symbol,
|
||||||
|
receiver: &Expr<'_>,
|
||||||
|
msrv: Option<&RustcVersion>,
|
||||||
|
) -> bool {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let Some(parent) = get_parent_expr(cx, expr);
|
if let Some(parent) = get_parent_expr(cx, expr);
|
||||||
if let Some(callee_def_id) = fn_def_id(cx, parent);
|
if let Some(callee_def_id) = fn_def_id(cx, parent);
|
||||||
|
@ -192,7 +207,7 @@ fn check_into_iter_call_arg(cx: &LateContext<'_>, expr: &Expr<'_>, method_name:
|
||||||
if unnecessary_iter_cloned::check_for_loop_iter(cx, parent, method_name, receiver, true) {
|
if unnecessary_iter_cloned::check_for_loop_iter(cx, parent, method_name, receiver, true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let cloned_or_copied = if is_copy(cx, item_ty) { "copied" } else { "cloned" };
|
let cloned_or_copied = if is_copy(cx, item_ty) && meets_msrv(msrv, &msrvs::ITERATOR_COPIED) { "copied" } else { "cloned" };
|
||||||
// The next suggestion may be incorrect because the removal of the `to_owned`-like
|
// The next suggestion may be incorrect because the removal of the `to_owned`-like
|
||||||
// function could cause the iterator to hold a reference to a resource that is used
|
// function could cause the iterator to hold a reference to a resource that is used
|
||||||
// mutably. See https://github.com/rust-lang/rust-clippy/issues/8148.
|
// mutably. See https://github.com/rust-lang/rust-clippy/issues/8148.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#![allow(clippy::ptr_arg)]
|
#![allow(clippy::ptr_arg)]
|
||||||
#![warn(clippy::unnecessary_to_owned)]
|
#![warn(clippy::unnecessary_to_owned)]
|
||||||
|
#![feature(custom_inner_attributes)]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::ffi::{CStr, CString, OsStr, OsString};
|
use std::ffi::{CStr, CString, OsStr, OsString};
|
||||||
|
@ -213,6 +214,17 @@ fn get_file_path(_file_type: &FileType) -> Result<std::path::PathBuf, std::io::E
|
||||||
|
|
||||||
fn require_string(_: &String) {}
|
fn require_string(_: &String) {}
|
||||||
|
|
||||||
|
fn _msrv_1_35() {
|
||||||
|
#![clippy::msrv = "1.35"]
|
||||||
|
// `copied` was stabilized in 1.36, so clippy should use `cloned`.
|
||||||
|
let _ = &["x"][..].iter().cloned();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _msrv_1_36() {
|
||||||
|
#![clippy::msrv = "1.36"]
|
||||||
|
let _ = &["x"][..].iter().copied();
|
||||||
|
}
|
||||||
|
|
||||||
// https://github.com/rust-lang/rust-clippy/issues/8507
|
// https://github.com/rust-lang/rust-clippy/issues/8507
|
||||||
mod issue_8507 {
|
mod issue_8507 {
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#![allow(clippy::ptr_arg)]
|
#![allow(clippy::ptr_arg)]
|
||||||
#![warn(clippy::unnecessary_to_owned)]
|
#![warn(clippy::unnecessary_to_owned)]
|
||||||
|
#![feature(custom_inner_attributes)]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::ffi::{CStr, CString, OsStr, OsString};
|
use std::ffi::{CStr, CString, OsStr, OsString};
|
||||||
|
@ -213,6 +214,17 @@ fn get_file_path(_file_type: &FileType) -> Result<std::path::PathBuf, std::io::E
|
||||||
|
|
||||||
fn require_string(_: &String) {}
|
fn require_string(_: &String) {}
|
||||||
|
|
||||||
|
fn _msrv_1_35() {
|
||||||
|
#![clippy::msrv = "1.35"]
|
||||||
|
// `copied` was stabilized in 1.36, so clippy should use `cloned`.
|
||||||
|
let _ = &["x"][..].to_vec().into_iter();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _msrv_1_36() {
|
||||||
|
#![clippy::msrv = "1.36"]
|
||||||
|
let _ = &["x"][..].to_vec().into_iter();
|
||||||
|
}
|
||||||
|
|
||||||
// https://github.com/rust-lang/rust-clippy/issues/8507
|
// https://github.com/rust-lang/rust-clippy/issues/8507
|
||||||
mod issue_8507 {
|
mod issue_8507 {
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:150:64
|
--> $DIR/unnecessary_to_owned.rs:151:64
|
||||||
|
|
|
|
||||||
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
||||||
| ^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^ help: remove this
|
||||||
|
|
|
|
||||||
= note: `-D clippy::redundant-clone` implied by `-D warnings`
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
|
||||||
note: this value is dropped without further use
|
note: this value is dropped without further use
|
||||||
--> $DIR/unnecessary_to_owned.rs:150:20
|
--> $DIR/unnecessary_to_owned.rs:151:20
|
||||||
|
|
|
|
||||||
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:151:40
|
--> $DIR/unnecessary_to_owned.rs:152:40
|
||||||
|
|
|
|
||||||
LL | require_os_str(&OsString::from("x").to_os_string());
|
LL | require_os_str(&OsString::from("x").to_os_string());
|
||||||
| ^^^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
|
|
||||||
note: this value is dropped without further use
|
note: this value is dropped without further use
|
||||||
--> $DIR/unnecessary_to_owned.rs:151:21
|
--> $DIR/unnecessary_to_owned.rs:152:21
|
||||||
|
|
|
|
||||||
LL | require_os_str(&OsString::from("x").to_os_string());
|
LL | require_os_str(&OsString::from("x").to_os_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:152:48
|
--> $DIR/unnecessary_to_owned.rs:153:48
|
||||||
|
|
|
|
||||||
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
||||||
| ^^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
|
|
||||||
note: this value is dropped without further use
|
note: this value is dropped without further use
|
||||||
--> $DIR/unnecessary_to_owned.rs:152:19
|
--> $DIR/unnecessary_to_owned.rs:153:19
|
||||||
|
|
|
|
||||||
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:153:35
|
--> $DIR/unnecessary_to_owned.rs:154:35
|
||||||
|
|
|
|
||||||
LL | require_str(&String::from("x").to_string());
|
LL | require_str(&String::from("x").to_string());
|
||||||
| ^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^ help: remove this
|
||||||
|
|
|
|
||||||
note: this value is dropped without further use
|
note: this value is dropped without further use
|
||||||
--> $DIR/unnecessary_to_owned.rs:153:18
|
--> $DIR/unnecessary_to_owned.rs:154:18
|
||||||
|
|
|
|
||||||
LL | require_str(&String::from("x").to_string());
|
LL | require_str(&String::from("x").to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:59:36
|
--> $DIR/unnecessary_to_owned.rs:60:36
|
||||||
|
|
|
|
||||||
LL | require_c_str(&Cow::from(c_str).into_owned());
|
LL | require_c_str(&Cow::from(c_str).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
@ -56,427 +56,427 @@ LL | require_c_str(&Cow::from(c_str).into_owned());
|
||||||
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
|
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:60:19
|
--> $DIR/unnecessary_to_owned.rs:61:19
|
||||||
|
|
|
|
||||||
LL | require_c_str(&c_str.to_owned());
|
LL | require_c_str(&c_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `c_str`
|
| ^^^^^^^^^^^^^^^^^ help: use: `c_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_os_string`
|
error: unnecessary use of `to_os_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:62:20
|
--> $DIR/unnecessary_to_owned.rs:63:20
|
||||||
|
|
|
|
||||||
LL | require_os_str(&os_str.to_os_string());
|
LL | require_os_str(&os_str.to_os_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:63:38
|
--> $DIR/unnecessary_to_owned.rs:64:38
|
||||||
|
|
|
|
||||||
LL | require_os_str(&Cow::from(os_str).into_owned());
|
LL | require_os_str(&Cow::from(os_str).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:64:20
|
--> $DIR/unnecessary_to_owned.rs:65:20
|
||||||
|
|
|
|
||||||
LL | require_os_str(&os_str.to_owned());
|
LL | require_os_str(&os_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_path_buf`
|
error: unnecessary use of `to_path_buf`
|
||||||
--> $DIR/unnecessary_to_owned.rs:66:18
|
--> $DIR/unnecessary_to_owned.rs:67:18
|
||||||
|
|
|
|
||||||
LL | require_path(&path.to_path_buf());
|
LL | require_path(&path.to_path_buf());
|
||||||
| ^^^^^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:67:34
|
--> $DIR/unnecessary_to_owned.rs:68:34
|
||||||
|
|
|
|
||||||
LL | require_path(&Cow::from(path).into_owned());
|
LL | require_path(&Cow::from(path).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:68:18
|
--> $DIR/unnecessary_to_owned.rs:69:18
|
||||||
|
|
|
|
||||||
LL | require_path(&path.to_owned());
|
LL | require_path(&path.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:70:17
|
--> $DIR/unnecessary_to_owned.rs:71:17
|
||||||
|
|
|
|
||||||
LL | require_str(&s.to_string());
|
LL | require_str(&s.to_string());
|
||||||
| ^^^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:71:30
|
--> $DIR/unnecessary_to_owned.rs:72:30
|
||||||
|
|
|
|
||||||
LL | require_str(&Cow::from(s).into_owned());
|
LL | require_str(&Cow::from(s).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:72:17
|
--> $DIR/unnecessary_to_owned.rs:73:17
|
||||||
|
|
|
|
||||||
LL | require_str(&s.to_owned());
|
LL | require_str(&s.to_owned());
|
||||||
| ^^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:73:17
|
--> $DIR/unnecessary_to_owned.rs:74:17
|
||||||
|
|
|
|
||||||
LL | require_str(&x_ref.to_string());
|
LL | require_str(&x_ref.to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
|
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:75:19
|
--> $DIR/unnecessary_to_owned.rs:76:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&slice.to_vec());
|
LL | require_slice(&slice.to_vec());
|
||||||
| ^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:76:36
|
--> $DIR/unnecessary_to_owned.rs:77:36
|
||||||
|
|
|
|
||||||
LL | require_slice(&Cow::from(slice).into_owned());
|
LL | require_slice(&Cow::from(slice).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:77:19
|
--> $DIR/unnecessary_to_owned.rs:78:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&array.to_owned());
|
LL | require_slice(&array.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
|
| ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:78:19
|
--> $DIR/unnecessary_to_owned.rs:79:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&array_ref.to_owned());
|
LL | require_slice(&array_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
|
| ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:79:19
|
--> $DIR/unnecessary_to_owned.rs:80:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&slice.to_owned());
|
LL | require_slice(&slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:80:19
|
--> $DIR/unnecessary_to_owned.rs:81:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&x_ref.to_owned());
|
LL | require_slice(&x_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:82:42
|
--> $DIR/unnecessary_to_owned.rs:83:42
|
||||||
|
|
|
|
||||||
LL | require_x(&Cow::<X>::Owned(x.clone()).into_owned());
|
LL | require_x(&Cow::<X>::Owned(x.clone()).into_owned());
|
||||||
| ^^^^^^^^^^^^^ help: remove this
|
| ^^^^^^^^^^^^^ help: remove this
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:83:15
|
--> $DIR/unnecessary_to_owned.rs:84:15
|
||||||
|
|
|
|
||||||
LL | require_x(&x_ref.to_owned());
|
LL | require_x(&x_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:85:25
|
--> $DIR/unnecessary_to_owned.rs:86:25
|
||||||
|
|
|
|
||||||
LL | require_deref_c_str(c_str.to_owned());
|
LL | require_deref_c_str(c_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:86:26
|
--> $DIR/unnecessary_to_owned.rs:87:26
|
||||||
|
|
|
|
||||||
LL | require_deref_os_str(os_str.to_owned());
|
LL | require_deref_os_str(os_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:87:24
|
--> $DIR/unnecessary_to_owned.rs:88:24
|
||||||
|
|
|
|
||||||
LL | require_deref_path(path.to_owned());
|
LL | require_deref_path(path.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:88:23
|
--> $DIR/unnecessary_to_owned.rs:89:23
|
||||||
|
|
|
|
||||||
LL | require_deref_str(s.to_owned());
|
LL | require_deref_str(s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:89:25
|
--> $DIR/unnecessary_to_owned.rs:90:25
|
||||||
|
|
|
|
||||||
LL | require_deref_slice(slice.to_owned());
|
LL | require_deref_slice(slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:91:30
|
--> $DIR/unnecessary_to_owned.rs:92:30
|
||||||
|
|
|
|
||||||
LL | require_impl_deref_c_str(c_str.to_owned());
|
LL | require_impl_deref_c_str(c_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:92:31
|
--> $DIR/unnecessary_to_owned.rs:93:31
|
||||||
|
|
|
|
||||||
LL | require_impl_deref_os_str(os_str.to_owned());
|
LL | require_impl_deref_os_str(os_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:93:29
|
--> $DIR/unnecessary_to_owned.rs:94:29
|
||||||
|
|
|
|
||||||
LL | require_impl_deref_path(path.to_owned());
|
LL | require_impl_deref_path(path.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:94:28
|
--> $DIR/unnecessary_to_owned.rs:95:28
|
||||||
|
|
|
|
||||||
LL | require_impl_deref_str(s.to_owned());
|
LL | require_impl_deref_str(s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:95:30
|
--> $DIR/unnecessary_to_owned.rs:96:30
|
||||||
|
|
|
|
||||||
LL | require_impl_deref_slice(slice.to_owned());
|
LL | require_impl_deref_slice(slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:97:29
|
--> $DIR/unnecessary_to_owned.rs:98:29
|
||||||
|
|
|
|
||||||
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:97:43
|
--> $DIR/unnecessary_to_owned.rs:98:43
|
||||||
|
|
|
|
||||||
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:98:29
|
--> $DIR/unnecessary_to_owned.rs:99:29
|
||||||
|
|
|
|
||||||
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:98:47
|
--> $DIR/unnecessary_to_owned.rs:99:47
|
||||||
|
|
|
|
||||||
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:100:26
|
--> $DIR/unnecessary_to_owned.rs:101:26
|
||||||
|
|
|
|
||||||
LL | require_as_ref_c_str(c_str.to_owned());
|
LL | require_as_ref_c_str(c_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:101:27
|
--> $DIR/unnecessary_to_owned.rs:102:27
|
||||||
|
|
|
|
||||||
LL | require_as_ref_os_str(os_str.to_owned());
|
LL | require_as_ref_os_str(os_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:102:25
|
--> $DIR/unnecessary_to_owned.rs:103:25
|
||||||
|
|
|
|
||||||
LL | require_as_ref_path(path.to_owned());
|
LL | require_as_ref_path(path.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:103:24
|
--> $DIR/unnecessary_to_owned.rs:104:24
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str(s.to_owned());
|
LL | require_as_ref_str(s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:104:24
|
--> $DIR/unnecessary_to_owned.rs:105:24
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str(x.to_owned());
|
LL | require_as_ref_str(x.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `&x`
|
| ^^^^^^^^^^^^ help: use: `&x`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:105:26
|
--> $DIR/unnecessary_to_owned.rs:106:26
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice(array.to_owned());
|
LL | require_as_ref_slice(array.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:106:26
|
--> $DIR/unnecessary_to_owned.rs:107:26
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice(array_ref.to_owned());
|
LL | require_as_ref_slice(array_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:107:26
|
--> $DIR/unnecessary_to_owned.rs:108:26
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice(slice.to_owned());
|
LL | require_as_ref_slice(slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:109:31
|
--> $DIR/unnecessary_to_owned.rs:110:31
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_c_str(c_str.to_owned());
|
LL | require_impl_as_ref_c_str(c_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:110:32
|
--> $DIR/unnecessary_to_owned.rs:111:32
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_os_str(os_str.to_owned());
|
LL | require_impl_as_ref_os_str(os_str.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:111:30
|
--> $DIR/unnecessary_to_owned.rs:112:30
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_path(path.to_owned());
|
LL | require_impl_as_ref_path(path.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^ help: use: `path`
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:112:29
|
--> $DIR/unnecessary_to_owned.rs:113:29
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_str(s.to_owned());
|
LL | require_impl_as_ref_str(s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:113:29
|
--> $DIR/unnecessary_to_owned.rs:114:29
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_str(x.to_owned());
|
LL | require_impl_as_ref_str(x.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `&x`
|
| ^^^^^^^^^^^^ help: use: `&x`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:114:31
|
--> $DIR/unnecessary_to_owned.rs:115:31
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_slice(array.to_owned());
|
LL | require_impl_as_ref_slice(array.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:115:31
|
--> $DIR/unnecessary_to_owned.rs:116:31
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_slice(array_ref.to_owned());
|
LL | require_impl_as_ref_slice(array_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:116:31
|
--> $DIR/unnecessary_to_owned.rs:117:31
|
||||||
|
|
|
|
||||||
LL | require_impl_as_ref_slice(slice.to_owned());
|
LL | require_impl_as_ref_slice(slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
|
||||||
--> $DIR/unnecessary_to_owned.rs:118:30
|
|
||||||
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
|
||||||
--> $DIR/unnecessary_to_owned.rs:118:44
|
|
||||||
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:119:30
|
--> $DIR/unnecessary_to_owned.rs:119:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:119:44
|
--> $DIR/unnecessary_to_owned.rs:119:44
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:120:30
|
--> $DIR/unnecessary_to_owned.rs:120:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:120:44
|
--> $DIR/unnecessary_to_owned.rs:120:44
|
||||||
|
|
|
|
||||||
|
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
||||||
|
|
||||||
|
error: unnecessary use of `to_owned`
|
||||||
|
--> $DIR/unnecessary_to_owned.rs:121:30
|
||||||
|
|
|
||||||
|
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
||||||
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
|
error: unnecessary use of `to_owned`
|
||||||
|
--> $DIR/unnecessary_to_owned.rs:121:44
|
||||||
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:121:30
|
--> $DIR/unnecessary_to_owned.rs:122:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:121:48
|
--> $DIR/unnecessary_to_owned.rs:122:48
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:122:30
|
--> $DIR/unnecessary_to_owned.rs:123:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:122:52
|
--> $DIR/unnecessary_to_owned.rs:123:52
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:123:30
|
--> $DIR/unnecessary_to_owned.rs:124:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:123:48
|
--> $DIR/unnecessary_to_owned.rs:124:48
|
||||||
|
|
|
|
||||||
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
||||||
| ^^^^^^^^^^^^ help: use: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:125:20
|
--> $DIR/unnecessary_to_owned.rs:126:20
|
||||||
|
|
|
|
||||||
LL | let _ = x.join(&x_ref.to_string());
|
LL | let _ = x.join(&x_ref.to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:127:13
|
--> $DIR/unnecessary_to_owned.rs:128:13
|
||||||
|
|
|
|
||||||
LL | let _ = slice.to_vec().into_iter();
|
LL | let _ = slice.to_vec().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:128:13
|
--> $DIR/unnecessary_to_owned.rs:129:13
|
||||||
|
|
|
|
||||||
LL | let _ = slice.to_owned().into_iter();
|
LL | let _ = slice.to_owned().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:129:13
|
--> $DIR/unnecessary_to_owned.rs:130:13
|
||||||
|
|
|
|
||||||
LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter();
|
LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:130:13
|
--> $DIR/unnecessary_to_owned.rs:131:13
|
||||||
|
|
|
|
||||||
LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter();
|
LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:132:13
|
--> $DIR/unnecessary_to_owned.rs:133:13
|
||||||
|
|
|
|
||||||
LL | let _ = IntoIterator::into_iter(slice.to_vec());
|
LL | let _ = IntoIterator::into_iter(slice.to_vec());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:133:13
|
--> $DIR/unnecessary_to_owned.rs:134:13
|
||||||
|
|
|
|
||||||
LL | let _ = IntoIterator::into_iter(slice.to_owned());
|
LL | let _ = IntoIterator::into_iter(slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:134:13
|
--> $DIR/unnecessary_to_owned.rs:135:13
|
||||||
|
|
|
|
||||||
LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec());
|
LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:135:13
|
--> $DIR/unnecessary_to_owned.rs:136:13
|
||||||
|
|
|
|
||||||
LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned());
|
LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:196:14
|
--> $DIR/unnecessary_to_owned.rs:197:14
|
||||||
|
|
|
|
||||||
LL | for t in file_types.to_vec() {
|
LL | for t in file_types.to_vec() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -491,11 +491,23 @@ LL - let path = match get_file_path(&t) {
|
||||||
LL + let path = match get_file_path(t) {
|
LL + let path = match get_file_path(t) {
|
||||||
|
|
|
|
||||||
|
|
||||||
|
error: unnecessary use of `to_vec`
|
||||||
|
--> $DIR/unnecessary_to_owned.rs:220:14
|
||||||
|
|
|
||||||
|
LL | let _ = &["x"][..].to_vec().into_iter();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
|
||||||
|
|
||||||
|
error: unnecessary use of `to_vec`
|
||||||
|
--> $DIR/unnecessary_to_owned.rs:225:14
|
||||||
|
|
|
||||||
|
LL | let _ = &["x"][..].to_vec().into_iter();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:260:24
|
--> $DIR/unnecessary_to_owned.rs:272:24
|
||||||
|
|
|
|
||||||
LL | Box::new(build(y.to_string()))
|
LL | Box::new(build(y.to_string()))
|
||||||
| ^^^^^^^^^^^^^ help: use: `y`
|
| ^^^^^^^^^^^^^ help: use: `y`
|
||||||
|
|
||||||
error: aborting due to 77 previous errors
|
error: aborting due to 79 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue