From 0b810866ef8ffe4125f9c7aebb7d8b3792d2b7f1 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 21 Mar 2024 16:50:21 -0400 Subject: [PATCH] Eagerly convert some ctors to use their specialized ctors --- clippy_lints/src/methods/unnecessary_to_owned.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/clippy_lints/src/methods/unnecessary_to_owned.rs b/clippy_lints/src/methods/unnecessary_to_owned.rs index c234e4f9b11..6e525b5ff93 100644 --- a/clippy_lints/src/methods/unnecessary_to_owned.rs +++ b/clippy_lints/src/methods/unnecessary_to_owned.rs @@ -336,12 +336,9 @@ fn check_other_call_arg<'tcx>( && let Some((n_refs, receiver_ty)) = if n_refs > 0 || is_copy(cx, receiver_ty) { Some((n_refs, receiver_ty)) } else if trait_predicate.def_id() != deref_trait_id { - Some((1, Ty::new_ref(cx.tcx, + Some((1, Ty::new_imm_ref(cx.tcx, cx.tcx.lifetimes.re_erased, - ty::TypeAndMut { - ty: receiver_ty, - mutbl: Mutability::Not, - }, + receiver_ty, ))) } else { None