1
Fork 0

Merge commit 'a109190d70' into clippy-subtree-update

This commit is contained in:
Philipp Krones 2024-10-18 13:44:06 +02:00
parent c512a221c2
commit fea5e77da1
179 changed files with 4032 additions and 1752 deletions

View file

@ -86,12 +86,11 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, call_name: &str,
// changing the type, then we can move forward.
&& rcv_ty.peel_refs() == res_ty.peel_refs()
&& let Some(parent) = get_parent_expr(cx, expr)
&& let hir::ExprKind::MethodCall(segment, _, args, _) = parent.kind
// Check that it only has one argument.
&& let hir::ExprKind::MethodCall(segment, _, [arg], _) = parent.kind
&& segment.ident.span != expr.span
// We check that the called method name is `map`.
&& segment.ident.name == sym::map
// And that it only has one argument.
&& let [arg] = args
&& is_calling_clone(cx, arg)
// And that we are not recommending recv.clone() over Arc::clone() or similar
&& !should_call_clone_as_function(cx, rcv_ty)