diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-01 18:43:35 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-05 22:25:57 +0900 |
| commit | 4bcaddeeb23544eb2c86b600c3d775e2773758c2 (patch) | |
| tree | 565a007c45f4d890796abe66ad5d014f7fb7c4f7 /clippy_lints/src/methods/utils.rs | |
| parent | 9ae329232b368c6ca7352d403de9e34a71debc4b (diff) | |
| download | rust-4bcaddeeb23544eb2c86b600c3d775e2773758c2.tar.gz rust-4bcaddeeb23544eb2c86b600c3d775e2773758c2.zip | |
separate the receiver from arguments in HIR under /clippy
Diffstat (limited to 'clippy_lints/src/methods/utils.rs')
| -rw-r--r-- | clippy_lints/src/methods/utils.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/methods/utils.rs b/clippy_lints/src/methods/utils.rs index 3015531e843..ae6b165fdc3 100644 --- a/clippy_lints/src/methods/utils.rs +++ b/clippy_lints/src/methods/utils.rs @@ -28,7 +28,7 @@ pub(super) fn derefs_to_slice<'tcx>( } } - if let hir::ExprKind::MethodCall(path, [self_arg, ..], _) = &expr.kind { + if let hir::ExprKind::MethodCall(path, self_arg, ..) = &expr.kind { if path.ident.name == sym::iter && may_slice(cx, cx.typeck_results().expr_ty(self_arg)) { Some(self_arg) } else { @@ -139,9 +139,9 @@ impl<'cx, 'tcx> Visitor<'tcx> for CloneOrCopyVisitor<'cx, 'tcx> { self.addr_of_exprs.push(parent); return; }, - ExprKind::MethodCall(_, args, _) => { + ExprKind::MethodCall(.., args, _) => { if_chain! { - if args.iter().skip(1).all(|arg| !self.is_binding(arg)); + if args.iter().all(|arg| !self.is_binding(arg)); if let Some(method_def_id) = self.cx.typeck_results().type_dependent_def_id(parent.hir_id); let method_ty = self.cx.tcx.type_of(method_def_id); let self_ty = method_ty.fn_sig(self.cx.tcx).input(0).skip_binder(); |
