diff options
| author | bors <bors@rust-lang.org> | 2024-08-03 07:32:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-03 07:32:30 +0000 |
| commit | 1ea827fa03c44d4d4befcbee9e8465bcbdbeae03 (patch) | |
| tree | 36b3d02fc21227871732ab3cc9e4168879a7e7f8 /clippy_lints/src/methods/implicit_clone.rs | |
| parent | 1aa686b9c0fc0239110dcd00371d04666b14bdf7 (diff) | |
| parent | a5fd2c98bdf1881e553500cad4d8ce3b970a0a97 (diff) | |
Auto merge of #13115 - tesuji:rm-dup-peels, r=dswij
Remove duplicated `peel_middle_ty_refs` TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too? changelog: none
Diffstat (limited to 'clippy_lints/src/methods/implicit_clone.rs')
| -rw-r--r-- | clippy_lints/src/methods/implicit_clone.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/methods/implicit_clone.rs b/clippy_lints/src/methods/implicit_clone.rs index c510cd915d0..519091406cc 100644 --- a/clippy_lints/src/methods/implicit_clone.rs +++ b/clippy_lints/src/methods/implicit_clone.rs @@ -1,7 +1,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet_with_context; -use clippy_utils::ty::{implements_trait, peel_mid_ty_refs}; -use clippy_utils::{is_diag_item_method, is_diag_trait_item}; +use clippy_utils::ty::implements_trait; +use clippy_utils::{is_diag_item_method, is_diag_trait_item, peel_middle_ty_refs}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::LateContext; @@ -14,7 +14,7 @@ pub fn check(cx: &LateContext<'_>, method_name: &str, expr: &hir::Expr<'_>, recv && is_clone_like(cx, method_name, method_def_id) && let return_type = cx.typeck_results().expr_ty(expr) && let input_type = cx.typeck_results().expr_ty(recv) - && let (input_type, ref_count) = peel_mid_ty_refs(input_type) + && let (input_type, ref_count) = peel_middle_ty_refs(input_type) && !(ref_count > 0 && is_diag_trait_item(cx, method_def_id, sym::ToOwned)) && let Some(ty_name) = input_type.ty_adt_def().map(|adt_def| cx.tcx.item_name(adt_def.did())) && return_type == input_type |
