Merge commit '9725c4a162
' into clippy-subtree-update
This commit is contained in:
parent
53e31dc45c
commit
0ae4a048c6
444 changed files with 5289 additions and 1934 deletions
|
@ -1,6 +1,6 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::walk_ptrs_ty_depth;
|
||||
use clippy_utils::ty::{should_call_clone_as_function, walk_ptrs_ty_depth};
|
||||
use clippy_utils::{
|
||||
get_parent_expr, is_diag_trait_item, match_def_path, path_to_local_id, paths, peel_blocks, strip_pat_refs,
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, call_name: &str,
|
|||
cx,
|
||||
USELESS_ASREF,
|
||||
expr.span,
|
||||
&format!("this call to `{call_name}` does nothing"),
|
||||
format!("this call to `{call_name}` does nothing"),
|
||||
"try",
|
||||
snippet_with_applicability(cx, recvr.span, "..", &mut applicability).to_string(),
|
||||
applicability,
|
||||
|
@ -93,6 +93,8 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, call_name: &str,
|
|||
// 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)
|
||||
{
|
||||
lint_as_ref_clone(cx, expr.span.with_hi(parent.span.hi()), recvr, call_name);
|
||||
}
|
||||
|
@ -157,7 +159,7 @@ fn lint_as_ref_clone(cx: &LateContext<'_>, span: Span, recvr: &hir::Expr<'_>, ca
|
|||
cx,
|
||||
USELESS_ASREF,
|
||||
span,
|
||||
&format!("this call to `{call_name}.map(...)` does nothing"),
|
||||
format!("this call to `{call_name}.map(...)` does nothing"),
|
||||
"try",
|
||||
format!(
|
||||
"{}.clone()",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue