mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Fix binder handling in unnecessary_to_owned
This commit is contained in:
parent
87aed038da
commit
27c5b21fb6
4 changed files with 150 additions and 103 deletions
|
@ -15,8 +15,7 @@ use rustc_lint::LateContext;
|
||||||
use rustc_middle::mir::Mutability;
|
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::{
|
use rustc_middle::ty::{
|
||||||
self, ClauseKind, EarlyBinder, GenericArg, GenericArgKind, GenericArgsRef, ParamTy, ProjectionPredicate,
|
self, ClauseKind, GenericArg, GenericArgKind, GenericArgsRef, ParamTy, ProjectionPredicate, TraitPredicate, Ty,
|
||||||
TraitPredicate, Ty,
|
|
||||||
};
|
};
|
||||||
use rustc_span::{sym, Symbol};
|
use rustc_span::{sym, Symbol};
|
||||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||||
|
@ -359,6 +358,7 @@ fn get_input_traits_and_projections<'tcx>(
|
||||||
(trait_predicates, projection_predicates)
|
(trait_predicates, projection_predicates)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(clippy::too_many_lines)]
|
||||||
fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<'a>) -> bool {
|
fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<'a>) -> bool {
|
||||||
for (_, node) in cx.tcx.hir().parent_iter(expr.hir_id) {
|
for (_, node) in cx.tcx.hir().parent_iter(expr.hir_id) {
|
||||||
match node {
|
match node {
|
||||||
|
@ -387,22 +387,21 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
||||||
if let Some((callee_def_id, call_generic_args, recv, call_args)) =
|
if let Some((callee_def_id, call_generic_args, recv, call_args)) =
|
||||||
get_callee_generic_args_and_args(cx, parent_expr)
|
get_callee_generic_args_and_args(cx, parent_expr)
|
||||||
{
|
{
|
||||||
// FIXME: the `instantiate_identity()` below seems incorrect, since we eventually
|
let bound_fn_sig = cx.tcx.fn_sig(callee_def_id);
|
||||||
// call `tcx.try_instantiate_and_normalize_erasing_regions` further down
|
let fn_sig = bound_fn_sig.skip_binder();
|
||||||
// (i.e., we are explicitly not in the identity context).
|
|
||||||
let fn_sig = cx.tcx.fn_sig(callee_def_id).instantiate_identity().skip_binder();
|
|
||||||
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
|
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
|
||||||
&& let Some(param_ty) = fn_sig.inputs().get(arg_index)
|
&& let param_ty = fn_sig.input(arg_index).skip_binder()
|
||||||
&& let ty::Param(ParamTy { index: param_index , ..}) = param_ty.kind()
|
&& let ty::Param(ParamTy { index: param_index , ..}) = *param_ty.kind()
|
||||||
// https://github.com/rust-lang/rust-clippy/issues/9504 and https://github.com/rust-lang/rust-clippy/issues/10021
|
// https://github.com/rust-lang/rust-clippy/issues/9504 and https://github.com/rust-lang/rust-clippy/issues/10021
|
||||||
&& (*param_index as usize) < call_generic_args.len()
|
&& (param_index as usize) < call_generic_args.len()
|
||||||
{
|
{
|
||||||
if fn_sig
|
if fn_sig
|
||||||
|
.skip_binder()
|
||||||
.inputs()
|
.inputs()
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|(i, _)| *i != arg_index)
|
.filter(|(i, _)| *i != arg_index)
|
||||||
.any(|(_, ty)| ty.contains(*param_ty))
|
.any(|(_, ty)| ty.contains(param_ty))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +413,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|predicate| {
|
.filter(|predicate| {
|
||||||
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
|
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
|
||||||
&& trait_predicate.trait_ref.self_ty() == *param_ty
|
&& trait_predicate.trait_ref.self_ty() == param_ty
|
||||||
{
|
{
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -425,7 +424,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
||||||
let new_subst = cx
|
let new_subst = cx
|
||||||
.tcx
|
.tcx
|
||||||
.mk_args_from_iter(call_generic_args.iter().enumerate().map(|(i, t)| {
|
.mk_args_from_iter(call_generic_args.iter().enumerate().map(|(i, t)| {
|
||||||
if i == (*param_index as usize) {
|
if i == param_index as usize {
|
||||||
GenericArg::from(ty)
|
GenericArg::from(ty)
|
||||||
} else {
|
} else {
|
||||||
t
|
t
|
||||||
|
@ -433,7 +432,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if trait_predicates.any(|predicate| {
|
if trait_predicates.any(|predicate| {
|
||||||
let predicate = EarlyBinder::bind(predicate).instantiate(cx.tcx, new_subst);
|
let predicate = bound_fn_sig.rebind(predicate).instantiate(cx.tcx, new_subst);
|
||||||
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
|
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
|
||||||
!cx.tcx
|
!cx.tcx
|
||||||
.infer_ctxt()
|
.infer_ctxt()
|
||||||
|
@ -443,12 +442,12 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let output_ty = fn_sig.output();
|
let output_ty = cx.tcx.instantiate_bound_regions_with_erased(fn_sig.output());
|
||||||
if output_ty.contains(*param_ty) {
|
if output_ty.contains(param_ty) {
|
||||||
if let Ok(new_ty) = cx.tcx.try_instantiate_and_normalize_erasing_regions(
|
if let Ok(new_ty) = cx.tcx.try_instantiate_and_normalize_erasing_regions(
|
||||||
new_subst,
|
new_subst,
|
||||||
cx.param_env,
|
cx.param_env,
|
||||||
EarlyBinder::bind(output_ty),
|
bound_fn_sig.rebind(output_ty),
|
||||||
) {
|
) {
|
||||||
expr = parent_expr;
|
expr = parent_expr;
|
||||||
ty = new_ty;
|
ty = new_ty;
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#![allow(clippy::needless_borrow, clippy::needless_borrows_for_generic_args, clippy::ptr_arg)]
|
#![allow(
|
||||||
|
clippy::needless_borrow,
|
||||||
|
clippy::needless_borrows_for_generic_args,
|
||||||
|
clippy::ptr_arg,
|
||||||
|
clippy::manual_async_fn,
|
||||||
|
clippy::needless_lifetimes
|
||||||
|
)]
|
||||||
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
|
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -506,3 +512,18 @@ mod issue_10033 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod issue_11952 {
|
||||||
|
use core::future::{Future, IntoFuture};
|
||||||
|
|
||||||
|
fn foo<'a, T: AsRef<[u8]>>(x: T, y: &'a i32) -> impl 'a + Future<Output = Result<(), ()>> {
|
||||||
|
async move {
|
||||||
|
let _y = y;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
IntoFuture::into_future(foo([], &0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#![allow(clippy::needless_borrow, clippy::needless_borrows_for_generic_args, clippy::ptr_arg)]
|
#![allow(
|
||||||
|
clippy::needless_borrow,
|
||||||
|
clippy::needless_borrows_for_generic_args,
|
||||||
|
clippy::ptr_arg,
|
||||||
|
clippy::manual_async_fn,
|
||||||
|
clippy::needless_lifetimes
|
||||||
|
)]
|
||||||
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
|
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -506,3 +512,18 @@ mod issue_10033 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod issue_11952 {
|
||||||
|
use core::future::{Future, IntoFuture};
|
||||||
|
|
||||||
|
fn foo<'a, T: AsRef<[u8]>>(x: T, y: &'a i32) -> impl 'a + Future<Output = Result<(), ()>> {
|
||||||
|
async move {
|
||||||
|
let _y = y;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
IntoFuture::into_future(foo([].to_vec(), &0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:148:64
|
--> $DIR/unnecessary_to_owned.rs:154: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: this value is dropped without further use
|
note: this value is dropped without further use
|
||||||
--> $DIR/unnecessary_to_owned.rs:148:20
|
--> $DIR/unnecessary_to_owned.rs:154: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());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -13,55 +13,55 @@ LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned())
|
||||||
= help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
|
= help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
|
||||||
|
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:149:40
|
--> $DIR/unnecessary_to_owned.rs:155: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:149:21
|
--> $DIR/unnecessary_to_owned.rs:155: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:150:48
|
--> $DIR/unnecessary_to_owned.rs:156: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:150:19
|
--> $DIR/unnecessary_to_owned.rs:156: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:151:35
|
--> $DIR/unnecessary_to_owned.rs:157: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:151:18
|
--> $DIR/unnecessary_to_owned.rs:157:18
|
||||||
|
|
|
|
||||||
LL | require_str(&String::from("x").to_string());
|
LL | require_str(&String::from("x").to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: redundant clone
|
error: redundant clone
|
||||||
--> $DIR/unnecessary_to_owned.rs:152:39
|
--> $DIR/unnecessary_to_owned.rs:158:39
|
||||||
|
|
|
|
||||||
LL | require_slice(&[String::from("x")].to_owned());
|
LL | require_slice(&[String::from("x")].to_owned());
|
||||||
| ^^^^^^^^^^^ 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:20
|
--> $DIR/unnecessary_to_owned.rs:158:20
|
||||||
|
|
|
|
||||||
LL | require_slice(&[String::from("x")].to_owned());
|
LL | require_slice(&[String::from("x")].to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:57:36
|
--> $DIR/unnecessary_to_owned.rs:63: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
|
||||||
|
@ -70,415 +70,415 @@ LL | require_c_str(&Cow::from(c_str).into_owned());
|
||||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]`
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:58:19
|
--> $DIR/unnecessary_to_owned.rs:64: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:60:20
|
--> $DIR/unnecessary_to_owned.rs:66: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:61:38
|
--> $DIR/unnecessary_to_owned.rs:67: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:62:20
|
--> $DIR/unnecessary_to_owned.rs:68: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:64:18
|
--> $DIR/unnecessary_to_owned.rs:70: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:65:34
|
--> $DIR/unnecessary_to_owned.rs:71: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:66:18
|
--> $DIR/unnecessary_to_owned.rs:72: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:68:17
|
--> $DIR/unnecessary_to_owned.rs:74: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:69:30
|
--> $DIR/unnecessary_to_owned.rs:75: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:70:17
|
--> $DIR/unnecessary_to_owned.rs:76: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:71:17
|
--> $DIR/unnecessary_to_owned.rs:77: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:73:19
|
--> $DIR/unnecessary_to_owned.rs:79: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:74:36
|
--> $DIR/unnecessary_to_owned.rs:80: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:75:19
|
--> $DIR/unnecessary_to_owned.rs:81: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:76:19
|
--> $DIR/unnecessary_to_owned.rs:82: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:77:19
|
--> $DIR/unnecessary_to_owned.rs:83:19
|
||||||
|
|
|
|
||||||
LL | require_slice(&slice.to_owned());
|
LL | require_slice(&slice.to_owned());
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `slice`
|
| ^^^^^^^^^^^^^^^^^ help: use: `slice`
|
||||||
|
|
||||||
error: unnecessary use of `into_owned`
|
error: unnecessary use of `into_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:80:42
|
--> $DIR/unnecessary_to_owned.rs:86: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:25
|
--> $DIR/unnecessary_to_owned.rs:89: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:84:26
|
--> $DIR/unnecessary_to_owned.rs:90: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:85:24
|
--> $DIR/unnecessary_to_owned.rs:91: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:86:23
|
--> $DIR/unnecessary_to_owned.rs:92: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:87:25
|
--> $DIR/unnecessary_to_owned.rs:93: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:89:30
|
--> $DIR/unnecessary_to_owned.rs:95: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:90:31
|
--> $DIR/unnecessary_to_owned.rs:96: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:91:29
|
--> $DIR/unnecessary_to_owned.rs:97: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:92:28
|
--> $DIR/unnecessary_to_owned.rs:98: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:93:30
|
--> $DIR/unnecessary_to_owned.rs:99: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:95:29
|
--> $DIR/unnecessary_to_owned.rs:101: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:95:43
|
--> $DIR/unnecessary_to_owned.rs:101: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:96:29
|
--> $DIR/unnecessary_to_owned.rs:102: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:96:47
|
--> $DIR/unnecessary_to_owned.rs:102: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:98:26
|
--> $DIR/unnecessary_to_owned.rs:104: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:99:27
|
--> $DIR/unnecessary_to_owned.rs:105: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:100:25
|
--> $DIR/unnecessary_to_owned.rs:106: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:101:24
|
--> $DIR/unnecessary_to_owned.rs:107: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:102:24
|
--> $DIR/unnecessary_to_owned.rs:108: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:103:26
|
--> $DIR/unnecessary_to_owned.rs:109: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:104:26
|
--> $DIR/unnecessary_to_owned.rs:110: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:105:26
|
--> $DIR/unnecessary_to_owned.rs:111: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:107:31
|
--> $DIR/unnecessary_to_owned.rs:113: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:108:32
|
--> $DIR/unnecessary_to_owned.rs:114: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:109:30
|
--> $DIR/unnecessary_to_owned.rs:115: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:110:29
|
--> $DIR/unnecessary_to_owned.rs:116: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:111:29
|
--> $DIR/unnecessary_to_owned.rs:117: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:112:31
|
--> $DIR/unnecessary_to_owned.rs:118: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:113:31
|
--> $DIR/unnecessary_to_owned.rs:119: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:114:31
|
--> $DIR/unnecessary_to_owned.rs:120: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`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:116:30
|
--> $DIR/unnecessary_to_owned.rs:122:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array.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:116:44
|
--> $DIR/unnecessary_to_owned.rs:122:44
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), 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:117:30
|
--> $DIR/unnecessary_to_owned.rs:123:30
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array_ref.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:117:44
|
--> $DIR/unnecessary_to_owned.rs:123:44
|
||||||
|
|
|
|
||||||
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
LL | require_as_ref_str_slice(s.to_owned(), 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:118:30
|
--> $DIR/unnecessary_to_owned.rs:124:30
|
||||||
|
|
|
|
||||||
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: `s`
|
| ^^^^^^^^^^^^ help: use: `s`
|
||||||
|
|
||||||
error: unnecessary use of `to_owned`
|
error: unnecessary use of `to_owned`
|
||||||
--> $DIR/unnecessary_to_owned.rs:118:44
|
--> $DIR/unnecessary_to_owned.rs:124: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:119:30
|
--> $DIR/unnecessary_to_owned.rs:125: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:119:48
|
--> $DIR/unnecessary_to_owned.rs:125: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:120:30
|
--> $DIR/unnecessary_to_owned.rs:126: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:120:52
|
--> $DIR/unnecessary_to_owned.rs:126: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:121:30
|
--> $DIR/unnecessary_to_owned.rs:127: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:121:48
|
--> $DIR/unnecessary_to_owned.rs:127: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:123:20
|
--> $DIR/unnecessary_to_owned.rs:129: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:125:13
|
--> $DIR/unnecessary_to_owned.rs:131: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:126:13
|
--> $DIR/unnecessary_to_owned.rs:132: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:127:13
|
--> $DIR/unnecessary_to_owned.rs:133: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:128:13
|
--> $DIR/unnecessary_to_owned.rs:134: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:130:13
|
--> $DIR/unnecessary_to_owned.rs:136: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:131:13
|
--> $DIR/unnecessary_to_owned.rs:137: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:132:13
|
--> $DIR/unnecessary_to_owned.rs:138: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:133:13
|
--> $DIR/unnecessary_to_owned.rs:139: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:195:14
|
--> $DIR/unnecessary_to_owned.rs:201:14
|
||||||
|
|
|
|
||||||
LL | for t in file_types.to_vec() {
|
LL | for t in file_types.to_vec() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -494,28 +494,34 @@ LL + let path = match get_file_path(t) {
|
||||||
|
|
|
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:218:14
|
--> $DIR/unnecessary_to_owned.rs:224:14
|
||||||
|
|
|
|
||||||
LL | let _ = &["x"][..].to_vec().into_iter();
|
LL | let _ = &["x"][..].to_vec().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:223:14
|
--> $DIR/unnecessary_to_owned.rs:229:14
|
||||||
|
|
|
|
||||||
LL | let _ = &["x"][..].to_vec().into_iter();
|
LL | let _ = &["x"][..].to_vec().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:270:24
|
--> $DIR/unnecessary_to_owned.rs:276:24
|
||||||
|
|
|
|
||||||
LL | Box::new(build(y.to_string()))
|
LL | Box::new(build(y.to_string()))
|
||||||
| ^^^^^^^^^^^^^ help: use: `y`
|
| ^^^^^^^^^^^^^ help: use: `y`
|
||||||
|
|
||||||
error: unnecessary use of `to_string`
|
error: unnecessary use of `to_string`
|
||||||
--> $DIR/unnecessary_to_owned.rs:378:12
|
--> $DIR/unnecessary_to_owned.rs:384:12
|
||||||
|
|
|
|
||||||
LL | id("abc".to_string())
|
LL | id("abc".to_string())
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use: `"abc"`
|
| ^^^^^^^^^^^^^^^^^ help: use: `"abc"`
|
||||||
|
|
||||||
error: aborting due to 79 previous errors
|
error: unnecessary use of `to_vec`
|
||||||
|
--> $DIR/unnecessary_to_owned.rs:527:37
|
||||||
|
|
|
||||||
|
LL | IntoFuture::into_future(foo([].to_vec(), &0));
|
||||||
|
| ^^^^^^^^^^^ help: use: `[]`
|
||||||
|
|
||||||
|
error: aborting due to 80 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue