about summary refs log tree commit diff
path: root/compiler/rustc_ast_pretty/src/pprust
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-08-07 15:21:11 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-08-10 18:34:54 +0200
commit970184528718d7c10579cac7b7e7e66ef2e2a3f5 (patch)
treea44dde46934f594c8eaf16bf66d4eb2d4a39efbd /compiler/rustc_ast_pretty/src/pprust
parent1603a70f82240ba2d27f72f964e36614d7620ad3 (diff)
downloadrust-970184528718d7c10579cac7b7e7e66ef2e2a3f5.tar.gz
rust-970184528718d7c10579cac7b7e7e66ef2e2a3f5.zip
Do not consider method call receiver as an argument in AST.
Diffstat (limited to 'compiler/rustc_ast_pretty/src/pprust')
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index ead38caee28..bcefa8ce0b9 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -193,9 +193,13 @@ impl<'a> State<'a> {
         self.print_call_post(args)
     }
 
-    fn print_expr_method_call(&mut self, segment: &ast::PathSegment, args: &[P<ast::Expr>]) {
-        let base_args = &args[1..];
-        self.print_expr_maybe_paren(&args[0], parser::PREC_POSTFIX);
+    fn print_expr_method_call(
+        &mut self,
+        segment: &ast::PathSegment,
+        receiver: &ast::Expr,
+        base_args: &[P<ast::Expr>],
+    ) {
+        self.print_expr_maybe_paren(receiver, parser::PREC_POSTFIX);
         self.word(".");
         self.print_ident(segment.ident);
         if let Some(ref args) = segment.args {
@@ -303,8 +307,8 @@ impl<'a> State<'a> {
             ast::ExprKind::Call(ref func, ref args) => {
                 self.print_expr_call(func, &args);
             }
-            ast::ExprKind::MethodCall(ref segment, ref args, _) => {
-                self.print_expr_method_call(segment, &args);
+            ast::ExprKind::MethodCall(ref segment, ref receiver, ref args, _) => {
+                self.print_expr_method_call(segment, &receiver, &args);
             }
             ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
                 self.print_expr_binary(op, lhs, rhs);