]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/ptr.rs
separate the receiver from arguments in HIR under /clippy
[rust.git] / clippy_lints / src / ptr.rs
index 3c5ea2d94144faf0718772b5342befcc510c7b8e..63c9faf0396fd3d8ffdd6a610113147827b552df 100644 (file)
@@ -591,8 +591,11 @@ fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
                             set_skip_flag();
                         }
                     },
-                    ExprKind::MethodCall(name, expr_args @ [self_arg, ..], _) => {
-                        let i = expr_args.iter().position(|arg| arg.hir_id == child_id).unwrap_or(0);
+                    ExprKind::MethodCall(name, self_arg, expr_args, _) => {
+                        let i = std::iter::once(self_arg)
+                            .chain(expr_args.iter())
+                            .position(|arg| arg.hir_id == child_id)
+                            .unwrap_or(0);
                         if i == 0 {
                             // Check if the method can be renamed.
                             let name = name.ident.as_str();