diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-21 16:50:21 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-03-22 11:12:01 -0400 |
| commit | 0b810866ef8ffe4125f9c7aebb7d8b3792d2b7f1 (patch) | |
| tree | 81ea20aeb995b82c264a01a028ec64090f391d98 | |
| parent | 879899ca8963e8035172b649169143824a849f5d (diff) | |
| download | rust-0b810866ef8ffe4125f9c7aebb7d8b3792d2b7f1.tar.gz rust-0b810866ef8ffe4125f9c7aebb7d8b3792d2b7f1.zip | |
Eagerly convert some ctors to use their specialized ctors
| -rw-r--r-- | clippy_lints/src/methods/unnecessary_to_owned.rs | 7 |
1 files 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 |
