From 5f8d8f165606775fcf81dfb27ac9de19f60a7bee Mon Sep 17 00:00:00 2001 From: maekawatoshiki Date: Thu, 14 Mar 2024 12:48:34 +0900 Subject: [PATCH] Simplify logic --- clippy_lints/src/methods/map_clone.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/methods/map_clone.rs b/clippy_lints/src/methods/map_clone.rs index 8d2a2410ed4..c3c7a3a0033 100644 --- a/clippy_lints/src/methods/map_clone.rs +++ b/clippy_lints/src/methods/map_clone.rs @@ -122,9 +122,8 @@ fn handle_path( && let args = args.as_slice() && let Some(ty) = args.iter().find_map(|generic_arg| generic_arg.as_type()) && let ty::Ref(_, ty, Mutability::Not) = ty.kind() - && let ty::Adt(_, args) = cx.typeck_results().expr_ty(e).kind() - && let args = args.as_slice() - && args.iter().find_map(|generic_arg| generic_arg.as_type()) == Some(*ty) + && let ty::FnDef(_, lst) = cx.typeck_results().expr_ty(arg).kind() + && lst.iter().all(|l| l.as_type() == Some(*ty)) { lint_path(cx, e.span, recv.span, is_copy(cx, ty.peel_refs())); }