about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/ui-fulldeps/pprust-expr-roundtrip.rs30
-rw-r--r--src/test/ui/stats/hir-stats.stderr178
-rw-r--r--src/tools/clippy/clippy_lints/src/double_parens.rs8
-rw-r--r--src/tools/clippy/clippy_lints/src/option_env_unwrap.rs6
-rw-r--r--src/tools/clippy/clippy_lints/src/precedence.rs8
-rw-r--r--src/tools/clippy/clippy_lints/src/redundant_closure_call.rs12
-rw-r--r--src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/unused_rounding.rs6
-rw-r--r--src/tools/clippy/clippy_utils/src/ast_utils.rs32
-rw-r--r--src/tools/rustfmt/src/attr.rs6
-rw-r--r--src/tools/rustfmt/src/chains.rs12
-rw-r--r--src/tools/rustfmt/src/closures.rs30
-rw-r--r--src/tools/rustfmt/src/expr.rs26
-rw-r--r--src/tools/rustfmt/src/patterns.rs9
-rw-r--r--src/tools/rustfmt/src/types.rs8
-rw-r--r--src/tools/rustfmt/src/utils.rs2
17 files changed, 205 insertions, 174 deletions
diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
index 117b798710c..c68ae63ddb3 100644
--- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -73,11 +73,15 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
             2 => {
                 let seg = PathSegment::from_ident(Ident::from_str("x"));
                 iter_exprs(depth - 1, &mut |e| {
-                    g(ExprKind::MethodCall(seg.clone(), e, vec![make_x()], DUMMY_SP))
-                });
+                    g(ExprKind::MethodCall(Box::new(MethodCall {
+                        seg: seg.clone(), receiver: e, args: vec![make_x()], span: DUMMY_SP
+                    }))
+                )});
                 iter_exprs(depth - 1, &mut |e| {
-                    g(ExprKind::MethodCall(seg.clone(), make_x(), vec![e], DUMMY_SP))
-                });
+                    g(ExprKind::MethodCall(Box::new(MethodCall {
+                        seg: seg.clone(), receiver: make_x(), args: vec![e], span: DUMMY_SP
+                    }))
+                )});
             }
             3..=8 => {
                 let op = Spanned {
@@ -112,15 +116,15 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
             11 => {
                 let decl = P(FnDecl { inputs: vec![], output: FnRetTy::Default(DUMMY_SP) });
                 iter_exprs(depth - 1, &mut |e| {
-                    g(ExprKind::Closure(
-                        ClosureBinder::NotPresent,
-                        CaptureBy::Value,
-                        Async::No,
-                        Movability::Movable,
-                        decl.clone(),
-                        e,
-                        DUMMY_SP,
-                    ))
+                    g(ExprKind::Closure(Box::new(Closure {
+                        binder: ClosureBinder::NotPresent,
+                        capture_clause: CaptureBy::Value,
+                        asyncness: Async::No,
+                        movability: Movability::Movable,
+                        fn_decl: decl.clone(),
+                        body: e,
+                        fn_decl_span: DUMMY_SP,
+                    })))
                 });
             }
             12 => {
diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr
index 1521b692a75..c61e8254385 100644
--- a/src/test/ui/stats/hir-stats.stderr
+++ b/src/test/ui/stats/hir-stats.stderr
@@ -11,109 +11,109 @@ ast-stats-1 - AngleBracketed            64 ( 0.8%)             1
 ast-stats-1 Local                     72 ( 0.9%)             1            72
 ast-stats-1 WherePredicate            72 ( 0.9%)             1            72
 ast-stats-1 - BoundPredicate            72 ( 0.9%)             1
-ast-stats-1 Arm                       96 ( 1.1%)             2            48
-ast-stats-1 ForeignItem               96 ( 1.1%)             1            96
-ast-stats-1 - Fn                        96 ( 1.1%)             1
-ast-stats-1 FieldDef                 160 ( 1.9%)             2            80
-ast-stats-1 Stmt                     160 ( 1.9%)             5            32
+ast-stats-1 Arm                       96 ( 1.2%)             2            48
+ast-stats-1 ForeignItem               96 ( 1.2%)             1            96
+ast-stats-1 - Fn                        96 ( 1.2%)             1
+ast-stats-1 FieldDef                 160 ( 2.0%)             2            80
+ast-stats-1 Stmt                     160 ( 2.0%)             5            32
 ast-stats-1 - Local                     32 ( 0.4%)             1
 ast-stats-1 - MacCall                   32 ( 0.4%)             1
-ast-stats-1 - Expr                      96 ( 1.1%)             3
-ast-stats-1 Param                    160 ( 1.9%)             4            40
-ast-stats-1 FnDecl                   200 ( 2.4%)             5            40
-ast-stats-1 Variant                  240 ( 2.9%)             2           120
-ast-stats-1 Block                    288 ( 3.4%)             6            48
-ast-stats-1 GenericBound             352 ( 4.2%)             4            88
-ast-stats-1 - Trait                    352 ( 4.2%)             4
-ast-stats-1 AssocItem                416 ( 4.9%)             4           104
-ast-stats-1 - Type                     208 ( 2.5%)             2
-ast-stats-1 - Fn                       208 ( 2.5%)             2
-ast-stats-1 GenericParam             480 ( 5.7%)             5            96
-ast-stats-1 PathSegment              720 ( 8.6%)            30            24
-ast-stats-1 Expr                     832 ( 9.9%)             8           104
-ast-stats-1 - Path                     104 ( 1.2%)             1
-ast-stats-1 - Match                    104 ( 1.2%)             1
-ast-stats-1 - Struct                   104 ( 1.2%)             1
-ast-stats-1 - Lit                      208 ( 2.5%)             2
-ast-stats-1 - Block                    312 ( 3.7%)             3
-ast-stats-1 Pat                      840 (10.0%)             7           120
-ast-stats-1 - Struct                   120 ( 1.4%)             1
-ast-stats-1 - Wild                     120 ( 1.4%)             1
-ast-stats-1 - Ident                    600 ( 7.1%)             5
-ast-stats-1 Ty                     1_344 (16.0%)            14            96
-ast-stats-1 - Rptr                      96 ( 1.1%)             1
-ast-stats-1 - Ptr                       96 ( 1.1%)             1
-ast-stats-1 - ImplicitSelf             192 ( 2.3%)             2
-ast-stats-1 - Path                     960 (11.4%)            10
-ast-stats-1 Item                   1_656 (19.7%)             9           184
-ast-stats-1 - Trait                    184 ( 2.2%)             1
-ast-stats-1 - Enum                     184 ( 2.2%)             1
-ast-stats-1 - ForeignMod               184 ( 2.2%)             1
-ast-stats-1 - Impl                     184 ( 2.2%)             1
-ast-stats-1 - Fn                       368 ( 4.4%)             2
-ast-stats-1 - Use                      552 ( 6.6%)             3
+ast-stats-1 - Expr                      96 ( 1.2%)             3
+ast-stats-1 Param                    160 ( 2.0%)             4            40
+ast-stats-1 FnDecl                   200 ( 2.5%)             5            40
+ast-stats-1 Variant                  240 ( 3.0%)             2           120
+ast-stats-1 Block                    288 ( 3.6%)             6            48
+ast-stats-1 GenericBound             352 ( 4.4%)             4            88
+ast-stats-1 - Trait                    352 ( 4.4%)             4
+ast-stats-1 AssocItem                416 ( 5.2%)             4           104
+ast-stats-1 - Type                     208 ( 2.6%)             2
+ast-stats-1 - Fn                       208 ( 2.6%)             2
+ast-stats-1 GenericParam             480 ( 6.0%)             5            96
+ast-stats-1 Expr                     704 ( 8.9%)             8            88
+ast-stats-1 - Path                      88 ( 1.1%)             1
+ast-stats-1 - Match                     88 ( 1.1%)             1
+ast-stats-1 - Struct                    88 ( 1.1%)             1
+ast-stats-1 - Lit                      176 ( 2.2%)             2
+ast-stats-1 - Block                    264 ( 3.3%)             3
+ast-stats-1 PathSegment              720 ( 9.1%)            30            24
+ast-stats-1 Pat                      728 ( 9.2%)             7           104
+ast-stats-1 - Struct                   104 ( 1.3%)             1
+ast-stats-1 - Wild                     104 ( 1.3%)             1
+ast-stats-1 - Ident                    520 ( 6.5%)             5
+ast-stats-1 Ty                     1_120 (14.1%)            14            80
+ast-stats-1 - Rptr                      80 ( 1.0%)             1
+ast-stats-1 - Ptr                       80 ( 1.0%)             1
+ast-stats-1 - ImplicitSelf             160 ( 2.0%)             2
+ast-stats-1 - Path                     800 (10.1%)            10
+ast-stats-1 Item                   1_656 (20.8%)             9           184
+ast-stats-1 - Trait                    184 ( 2.3%)             1
+ast-stats-1 - Enum                     184 ( 2.3%)             1
+ast-stats-1 - ForeignMod               184 ( 2.3%)             1
+ast-stats-1 - Impl                     184 ( 2.3%)             1
+ast-stats-1 - Fn                       368 ( 4.6%)             2
+ast-stats-1 - Use                      552 ( 6.9%)             3
 ast-stats-1 ----------------------------------------------------------------
-ast-stats-1 Total                  8_416
+ast-stats-1 Total                  7_952
 ast-stats-1
 ast-stats-2 POST EXPANSION AST STATS
 ast-stats-2 Name                Accumulated Size         Count     Item Size
 ast-stats-2 ----------------------------------------------------------------
-ast-stats-2 ExprField                 48 ( 0.5%)             1            48
+ast-stats-2 ExprField                 48 ( 0.6%)             1            48
 ast-stats-2 Crate                     56 ( 0.6%)             1            56
 ast-stats-2 GenericArgs               64 ( 0.7%)             1            64
 ast-stats-2 - AngleBracketed            64 ( 0.7%)             1
 ast-stats-2 Local                     72 ( 0.8%)             1            72
 ast-stats-2 WherePredicate            72 ( 0.8%)             1            72
 ast-stats-2 - BoundPredicate            72 ( 0.8%)             1
-ast-stats-2 Arm                       96 ( 1.0%)             2            48
-ast-stats-2 ForeignItem               96 ( 1.0%)             1            96
-ast-stats-2 - Fn                        96 ( 1.0%)             1
-ast-stats-2 InlineAsm                120 ( 1.3%)             1           120
-ast-stats-2 Attribute                128 ( 1.4%)             4            32
-ast-stats-2 - DocComment                32 ( 0.3%)             1
-ast-stats-2 - Normal                    96 ( 1.0%)             3
-ast-stats-2 FieldDef                 160 ( 1.7%)             2            80
-ast-stats-2 Stmt                     160 ( 1.7%)             5            32
-ast-stats-2 - Local                     32 ( 0.3%)             1
-ast-stats-2 - Semi                      32 ( 0.3%)             1
-ast-stats-2 - Expr                      96 ( 1.0%)             3
-ast-stats-2 Param                    160 ( 1.7%)             4            40
-ast-stats-2 FnDecl                   200 ( 2.2%)             5            40
-ast-stats-2 Variant                  240 ( 2.6%)             2           120
-ast-stats-2 Block                    288 ( 3.1%)             6            48
-ast-stats-2 GenericBound             352 ( 3.8%)             4            88
-ast-stats-2 - Trait                    352 ( 3.8%)             4
-ast-stats-2 AssocItem                416 ( 4.5%)             4           104
-ast-stats-2 - Type                     208 ( 2.3%)             2
-ast-stats-2 - Fn                       208 ( 2.3%)             2
-ast-stats-2 GenericParam             480 ( 5.2%)             5            96
-ast-stats-2 PathSegment              792 ( 8.7%)            33            24
-ast-stats-2 Pat                      840 ( 9.2%)             7           120
-ast-stats-2 - Struct                   120 ( 1.3%)             1
-ast-stats-2 - Wild                     120 ( 1.3%)             1
-ast-stats-2 - Ident                    600 ( 6.6%)             5
-ast-stats-2 Expr                     936 (10.2%)             9           104
-ast-stats-2 - Path                     104 ( 1.1%)             1
-ast-stats-2 - Match                    104 ( 1.1%)             1
-ast-stats-2 - Struct                   104 ( 1.1%)             1
-ast-stats-2 - InlineAsm                104 ( 1.1%)             1
-ast-stats-2 - Lit                      208 ( 2.3%)             2
-ast-stats-2 - Block                    312 ( 3.4%)             3
-ast-stats-2 Ty                     1_344 (14.7%)            14            96
-ast-stats-2 - Rptr                      96 ( 1.0%)             1
-ast-stats-2 - Ptr                       96 ( 1.0%)             1
-ast-stats-2 - ImplicitSelf             192 ( 2.1%)             2
-ast-stats-2 - Path                     960 (10.5%)            10
-ast-stats-2 Item                   2_024 (22.1%)            11           184
-ast-stats-2 - Trait                    184 ( 2.0%)             1
-ast-stats-2 - Enum                     184 ( 2.0%)             1
-ast-stats-2 - ExternCrate              184 ( 2.0%)             1
-ast-stats-2 - ForeignMod               184 ( 2.0%)             1
-ast-stats-2 - Impl                     184 ( 2.0%)             1
-ast-stats-2 - Fn                       368 ( 4.0%)             2
-ast-stats-2 - Use                      736 ( 8.0%)             4
+ast-stats-2 Arm                       96 ( 1.1%)             2            48
+ast-stats-2 ForeignItem               96 ( 1.1%)             1            96
+ast-stats-2 - Fn                        96 ( 1.1%)             1
+ast-stats-2 InlineAsm                120 ( 1.4%)             1           120
+ast-stats-2 Attribute                128 ( 1.5%)             4            32
+ast-stats-2 - DocComment                32 ( 0.4%)             1
+ast-stats-2 - Normal                    96 ( 1.1%)             3
+ast-stats-2 FieldDef                 160 ( 1.8%)             2            80
+ast-stats-2 Stmt                     160 ( 1.8%)             5            32
+ast-stats-2 - Local                     32 ( 0.4%)             1
+ast-stats-2 - Semi                      32 ( 0.4%)             1
+ast-stats-2 - Expr                      96 ( 1.1%)             3
+ast-stats-2 Param                    160 ( 1.8%)             4            40
+ast-stats-2 FnDecl                   200 ( 2.3%)             5            40
+ast-stats-2 Variant                  240 ( 2.8%)             2           120
+ast-stats-2 Block                    288 ( 3.3%)             6            48
+ast-stats-2 GenericBound             352 ( 4.1%)             4            88
+ast-stats-2 - Trait                    352 ( 4.1%)             4
+ast-stats-2 AssocItem                416 ( 4.8%)             4           104
+ast-stats-2 - Type                     208 ( 2.4%)             2
+ast-stats-2 - Fn                       208 ( 2.4%)             2
+ast-stats-2 GenericParam             480 ( 5.5%)             5            96
+ast-stats-2 Pat                      728 ( 8.4%)             7           104
+ast-stats-2 - Struct                   104 ( 1.2%)             1
+ast-stats-2 - Wild                     104 ( 1.2%)             1
+ast-stats-2 - Ident                    520 ( 6.0%)             5
+ast-stats-2 PathSegment              792 ( 9.1%)            33            24
+ast-stats-2 Expr                     792 ( 9.1%)             9            88
+ast-stats-2 - Path                      88 ( 1.0%)             1
+ast-stats-2 - Match                     88 ( 1.0%)             1
+ast-stats-2 - Struct                    88 ( 1.0%)             1
+ast-stats-2 - InlineAsm                 88 ( 1.0%)             1
+ast-stats-2 - Lit                      176 ( 2.0%)             2
+ast-stats-2 - Block                    264 ( 3.0%)             3
+ast-stats-2 Ty                     1_120 (12.9%)            14            80
+ast-stats-2 - Rptr                      80 ( 0.9%)             1
+ast-stats-2 - Ptr                       80 ( 0.9%)             1
+ast-stats-2 - ImplicitSelf             160 ( 1.8%)             2
+ast-stats-2 - Path                     800 ( 9.2%)            10
+ast-stats-2 Item                   2_024 (23.4%)            11           184
+ast-stats-2 - Trait                    184 ( 2.1%)             1
+ast-stats-2 - Enum                     184 ( 2.1%)             1
+ast-stats-2 - ExternCrate              184 ( 2.1%)             1
+ast-stats-2 - ForeignMod               184 ( 2.1%)             1
+ast-stats-2 - Impl                     184 ( 2.1%)             1
+ast-stats-2 - Fn                       368 ( 4.2%)             2
+ast-stats-2 - Use                      736 ( 8.5%)             4
 ast-stats-2 ----------------------------------------------------------------
-ast-stats-2 Total                  9_144
+ast-stats-2 Total                  8_664
 ast-stats-2
 hir-stats HIR STATS
 hir-stats Name                Accumulated Size         Count     Item Size
diff --git a/src/tools/clippy/clippy_lints/src/double_parens.rs b/src/tools/clippy/clippy_lints/src/double_parens.rs
index 0f1d701865e..29425b2e554 100644
--- a/src/tools/clippy/clippy_lints/src/double_parens.rs
+++ b/src/tools/clippy/clippy_lints/src/double_parens.rs
@@ -61,10 +61,10 @@ impl EarlyLintPass for DoubleParens {
                     }
                 }
             },
-            ExprKind::MethodCall(_, _, ref params, _) => {
-                if let [ref param] = params[..] {
-                    if let ExprKind::Paren(_) = param.kind {
-                        span_lint(cx, DOUBLE_PARENS, param.span, msg);
+            ExprKind::MethodCall(ref call) => {
+                if let [ref arg] = call.args[..] {
+                    if let ExprKind::Paren(_) = arg.kind {
+                        span_lint(cx, DOUBLE_PARENS, arg.span, msg);
                     }
                 }
             },
diff --git a/src/tools/clippy/clippy_lints/src/option_env_unwrap.rs b/src/tools/clippy/clippy_lints/src/option_env_unwrap.rs
index d9ee031c9f9..377bddeaa5f 100644
--- a/src/tools/clippy/clippy_lints/src/option_env_unwrap.rs
+++ b/src/tools/clippy/clippy_lints/src/option_env_unwrap.rs
@@ -1,7 +1,7 @@
 use clippy_utils::diagnostics::span_lint_and_help;
 use clippy_utils::is_direct_expn_of;
 use if_chain::if_chain;
-use rustc_ast::ast::{Expr, ExprKind};
+use rustc_ast::ast::{Expr, ExprKind, MethodCall};
 use rustc_lint::{EarlyContext, EarlyLintPass};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::sym;
@@ -37,8 +37,8 @@ declare_lint_pass!(OptionEnvUnwrap => [OPTION_ENV_UNWRAP]);
 impl EarlyLintPass for OptionEnvUnwrap {
     fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
         if_chain! {
-            if let ExprKind::MethodCall(path_segment, receiver, _, _) = &expr.kind;
-            if matches!(path_segment.ident.name, sym::expect | sym::unwrap);
+            if let ExprKind::MethodCall(box MethodCall { seg, receiver, .. }) = &expr.kind;
+            if matches!(seg.ident.name, sym::expect | sym::unwrap);
             if let ExprKind::Call(caller, _) = &receiver.kind;
             if is_direct_expn_of(caller.span, "option_env").is_some();
             then {
diff --git a/src/tools/clippy/clippy_lints/src/precedence.rs b/src/tools/clippy/clippy_lints/src/precedence.rs
index bee4a33fb4a..057b7e30642 100644
--- a/src/tools/clippy/clippy_lints/src/precedence.rs
+++ b/src/tools/clippy/clippy_lints/src/precedence.rs
@@ -1,7 +1,7 @@
 use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::source::snippet_with_applicability;
 use if_chain::if_chain;
-use rustc_ast::ast::{BinOpKind, Expr, ExprKind, UnOp};
+use rustc_ast::ast::{BinOpKind, Expr, ExprKind, MethodCall, UnOp};
 use rustc_ast::token;
 use rustc_errors::Applicability;
 use rustc_lint::{EarlyContext, EarlyLintPass};
@@ -110,11 +110,11 @@ impl EarlyLintPass for Precedence {
             let mut arg = operand;
 
             let mut all_odd = true;
-            while let ExprKind::MethodCall(path_segment, receiver, _, _) = &arg.kind {
-                let path_segment_str = path_segment.ident.name.as_str();
+            while let ExprKind::MethodCall(box MethodCall { seg, receiver, .. }) = &arg.kind {
+                let seg_str = seg.ident.name.as_str();
                 all_odd &= ALLOWED_ODD_FUNCTIONS
                     .iter()
-                    .any(|odd_function| **odd_function == *path_segment_str);
+                    .any(|odd_function| **odd_function == *seg_str);
                 arg = receiver;
             }
 
diff --git a/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs b/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs
index 74eea6de4bb..4cbe9597c53 100644
--- a/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs
+++ b/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs
@@ -69,10 +69,10 @@ impl EarlyLintPass for RedundantClosureCall {
         if_chain! {
             if let ast::ExprKind::Call(ref paren, _) = expr.kind;
             if let ast::ExprKind::Paren(ref closure) = paren.kind;
-            if let ast::ExprKind::Closure(_, _, ref r#async, _, ref decl, ref block, _) = closure.kind;
+            if let ast::ExprKind::Closure(box ast::Closure { ref asyncness, ref fn_decl, ref body, .. }) = closure.kind;
             then {
                 let mut visitor = ReturnVisitor::new();
-                visitor.visit_expr(block);
+                visitor.visit_expr(body);
                 if !visitor.found_return {
                     span_lint_and_then(
                         cx,
@@ -80,13 +80,13 @@ impl EarlyLintPass for RedundantClosureCall {
                         expr.span,
                         "try not to call a closure in the expression where it is declared",
                         |diag| {
-                            if decl.inputs.is_empty() {
+                            if fn_decl.inputs.is_empty() {
                                 let app = Applicability::MachineApplicable;
-                                let mut hint = Sugg::ast(cx, block, "..");
+                                let mut hint = Sugg::ast(cx, body, "..");
 
-                                if r#async.is_async() {
+                                if asyncness.is_async() {
                                     // `async x` is a syntax error, so it becomes `async { x }`
-                                    if !matches!(block.kind, ast::ExprKind::Block(_, _)) {
+                                    if !matches!(body.kind, ast::ExprKind::Block(_, _)) {
                                         hint = hint.blockify();
                                     }
 
diff --git a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
index eef9bdc7849..78e83880e1a 100644
--- a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
+++ b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
@@ -580,7 +580,7 @@ fn ident_difference_expr_with_base_location(
         | (Await(_), Await(_))
         | (Async(_, _, _), Async(_, _, _))
         | (Block(_, _), Block(_, _))
-        | (Closure(_, _, _, _, _, _, _), Closure(_, _, _, _, _, _, _))
+        | (Closure(_), Closure(_))
         | (Match(_, _), Match(_, _))
         | (Loop(_, _), Loop(_, _))
         | (ForLoop(_, _, _, _), ForLoop(_, _, _, _))
@@ -593,7 +593,7 @@ fn ident_difference_expr_with_base_location(
         | (Unary(_, _), Unary(_, _))
         | (Binary(_, _, _), Binary(_, _, _))
         | (Tup(_), Tup(_))
-        | (MethodCall(_, _, _, _), MethodCall(_, _, _, _))
+        | (MethodCall(_), MethodCall(_))
         | (Call(_, _), Call(_, _))
         | (ConstBlock(_), ConstBlock(_))
         | (Array(_), Array(_))
diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs
index b305dae7608..bb6fb38e969 100644
--- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs
+++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs
@@ -292,7 +292,7 @@ fn transform_with_focus_on_idx(alternatives: &mut Vec<P<Pat>>, focus_idx: usize)
 /// So when we fixate on some `ident_k: pat_k`, we try to find `ident_k` in the other pattern
 /// and check that all `fp_i` where `i ∈ ((0...n) \ k)` between two patterns are equal.
 fn extend_with_struct_pat(
-    qself1: &Option<ast::QSelf>,
+    qself1: &Option<P<ast::QSelf>>,
     path1: &ast::Path,
     fps1: &mut [ast::PatField],
     rest1: bool,
diff --git a/src/tools/clippy/clippy_lints/src/unused_rounding.rs b/src/tools/clippy/clippy_lints/src/unused_rounding.rs
index 3c1998d0237..5ab351bc29c 100644
--- a/src/tools/clippy/clippy_lints/src/unused_rounding.rs
+++ b/src/tools/clippy/clippy_lints/src/unused_rounding.rs
@@ -1,5 +1,5 @@
 use clippy_utils::diagnostics::span_lint_and_sugg;
-use rustc_ast::ast::{Expr, ExprKind};
+use rustc_ast::ast::{Expr, ExprKind, MethodCall};
 use rustc_errors::Applicability;
 use rustc_lint::{EarlyContext, EarlyLintPass};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -30,8 +30,8 @@ declare_clippy_lint! {
 declare_lint_pass!(UnusedRounding => [UNUSED_ROUNDING]);
 
 fn is_useless_rounding(expr: &Expr) -> Option<(&str, String)> {
-    if let ExprKind::MethodCall(name_ident, receiver, _, _) = &expr.kind
-        && let method_name = name_ident.ident.name.as_str()
+    if let ExprKind::MethodCall(box MethodCall { seg, receiver, .. }) = &expr.kind
+        && let method_name = seg.ident.name.as_str()
         && (method_name == "ceil" || method_name == "round" || method_name == "floor")
         && let ExprKind::Lit(token_lit) = &receiver.kind
         && token_lit.is_semantic_float() {
diff --git a/src/tools/clippy/clippy_utils/src/ast_utils.rs b/src/tools/clippy/clippy_utils/src/ast_utils.rs
index 73d1ba727c8..23aed4b5ba2 100644
--- a/src/tools/clippy/clippy_utils/src/ast_utils.rs
+++ b/src/tools/clippy/clippy_utils/src/ast_utils.rs
@@ -75,11 +75,11 @@ pub fn eq_field_pat(l: &PatField, r: &PatField) -> bool {
         && over(&l.attrs, &r.attrs, eq_attr)
 }
 
-pub fn eq_qself(l: &QSelf, r: &QSelf) -> bool {
+pub fn eq_qself(l: &P<QSelf>, r: &P<QSelf>) -> bool {
     l.position == r.position && eq_ty(&l.ty, &r.ty)
 }
 
-pub fn eq_maybe_qself(l: &Option<QSelf>, r: &Option<QSelf>) -> bool {
+pub fn eq_maybe_qself(l: &Option<P<QSelf>>, r: &Option<P<QSelf>>) -> bool {
     match (l, r) {
         (Some(l), Some(r)) => eq_qself(l, r),
         (None, None) => true,
@@ -147,8 +147,11 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
         (Array(l), Array(r)) | (Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),
         (Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value),
         (Call(lc, la), Call(rc, ra)) => eq_expr(lc, rc) && over(la, ra, |l, r| eq_expr(l, r)),
-        (MethodCall(lc, ls, la, _), MethodCall(rc, rs, ra, _)) => {
-            eq_path_seg(lc, rc) && eq_expr(ls, rs) && over(la, ra, |l, r| eq_expr(l, r))
+        (
+            MethodCall(box ast::MethodCall { seg: ls, receiver: lr, args: la, .. }),
+            MethodCall(box ast::MethodCall { seg: rs, receiver: rr, args: ra, .. })
+        ) => {
+            eq_path_seg(ls, rs) && eq_expr(lr, rr) && over(la, ra, |l, r| eq_expr(l, r))
         },
         (Binary(lo, ll, lr), Binary(ro, rl, rr)) => lo.node == ro.node && eq_expr(ll, rl) && eq_expr(lr, rr),
         (Unary(lo, l), Unary(ro, r)) => mem::discriminant(lo) == mem::discriminant(ro) && eq_expr(l, r),
@@ -170,7 +173,26 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
         (AssignOp(lo, lp, lv), AssignOp(ro, rp, rv)) => lo.node == ro.node && eq_expr(lp, rp) && eq_expr(lv, rv),
         (Field(lp, lf), Field(rp, rf)) => eq_id(*lf, *rf) && eq_expr(lp, rp),
         (Match(ls, la), Match(rs, ra)) => eq_expr(ls, rs) && over(la, ra, eq_arm),
-        (Closure(lb, lc, la, lm, lf, le, _), Closure(rb, rc, ra, rm, rf, re, _)) => {
+        (
+            Closure(box ast::Closure {
+                binder: lb,
+                capture_clause: lc,
+                asyncness: la,
+                movability: lm,
+                fn_decl: lf,
+                body: le,
+                ..
+            }),
+            Closure(box ast::Closure {
+                binder: rb,
+                capture_clause: rc,
+                asyncness: ra,
+                movability: rm,
+                fn_decl: rf,
+                body: re,
+                ..
+            })
+        ) => {
             eq_closure_binder(lb, rb)
                 && lc == rc
                 && la.is_async() == ra.is_async()
diff --git a/src/tools/rustfmt/src/attr.rs b/src/tools/rustfmt/src/attr.rs
index ccc2fd0d5f5..23f55db773e 100644
--- a/src/tools/rustfmt/src/attr.rs
+++ b/src/tools/rustfmt/src/attr.rs
@@ -290,10 +290,10 @@ impl Rewrite for ast::MetaItem {
     fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         Some(match self.kind {
             ast::MetaItemKind::Word => {
-                rewrite_path(context, PathContext::Type, None, &self.path, shape)?
+                rewrite_path(context, PathContext::Type, &None, &self.path, shape)?
             }
             ast::MetaItemKind::List(ref list) => {
-                let path = rewrite_path(context, PathContext::Type, None, &self.path, shape)?;
+                let path = rewrite_path(context, PathContext::Type, &None, &self.path, shape)?;
                 let has_trailing_comma = crate::expr::span_ends_with_comma(context, self.span);
                 overflow::rewrite_with_parens(
                     context,
@@ -311,7 +311,7 @@ impl Rewrite for ast::MetaItem {
                 )?
             }
             ast::MetaItemKind::NameValue(ref literal) => {
-                let path = rewrite_path(context, PathContext::Type, None, &self.path, shape)?;
+                let path = rewrite_path(context, PathContext::Type, &None, &self.path, shape)?;
                 // 3 = ` = `
                 let lit_shape = shape.shrink_left(path.len() + 3)?;
                 // `rewrite_literal` returns `None` when `literal` exceeds max
diff --git a/src/tools/rustfmt/src/chains.rs b/src/tools/rustfmt/src/chains.rs
index fcc02eca429..a1a73cf4bd5 100644
--- a/src/tools/rustfmt/src/chains.rs
+++ b/src/tools/rustfmt/src/chains.rs
@@ -145,8 +145,8 @@ impl ChainItemKind {
 
     fn from_ast(context: &RewriteContext<'_>, expr: &ast::Expr) -> (ChainItemKind, Span) {
         let (kind, span) = match expr.kind {
-            ast::ExprKind::MethodCall(ref segment, ref receiver, ref expressions, _) => {
-                let types = if let Some(ref generic_args) = segment.args {
+            ast::ExprKind::MethodCall(ref call) => {
+                let types = if let Some(ref generic_args) = call.seg.args {
                     if let ast::GenericArgs::AngleBracketed(ref data) = **generic_args {
                         data.args
                             .iter()
@@ -163,8 +163,8 @@ impl ChainItemKind {
                 } else {
                     vec![]
                 };
-                let span = mk_sp(receiver.span.hi(), expr.span.hi());
-                let kind = ChainItemKind::MethodCall(segment.clone(), types, expressions.clone());
+                let span = mk_sp(call.receiver.span.hi(), expr.span.hi());
+                let kind = ChainItemKind::MethodCall(call.seg.clone(), types, call.args.clone());
                 (kind, span)
             }
             ast::ExprKind::Field(ref nested, field) => {
@@ -400,9 +400,7 @@ impl Chain {
     // is a try! macro, we'll convert it to shorthand when the option is set.
     fn pop_expr_chain(expr: &ast::Expr, context: &RewriteContext<'_>) -> Option<ast::Expr> {
         match expr.kind {
-            ast::ExprKind::MethodCall(_, ref receiver, _, _) => {
-                Some(Self::convert_try(&receiver, context))
-            }
+            ast::ExprKind::MethodCall(ref call) => Some(Self::convert_try(&call.receiver, context)),
             ast::ExprKind::Field(ref subexpr, _)
             | ast::ExprKind::Try(ref subexpr)
             | ast::ExprKind::Await(ref subexpr) => Some(Self::convert_try(subexpr, context)),
diff --git a/src/tools/rustfmt/src/closures.rs b/src/tools/rustfmt/src/closures.rs
index 88a6bebb68c..423c3a997f5 100644
--- a/src/tools/rustfmt/src/closures.rs
+++ b/src/tools/rustfmt/src/closures.rs
@@ -326,16 +326,16 @@ pub(crate) fn rewrite_last_closure(
     expr: &ast::Expr,
     shape: Shape,
 ) -> Option<String> {
-    if let ast::ExprKind::Closure(
-        ref binder,
-        capture,
-        ref is_async,
-        movability,
-        ref fn_decl,
-        ref body,
-        _,
-    ) = expr.kind
-    {
+    if let ast::ExprKind::Closure(ref closure) = expr.kind {
+        let ast::Closure {
+            ref binder,
+            capture_clause,
+            ref asyncness,
+            movability,
+            ref fn_decl,
+            ref body,
+            fn_decl_span: _,
+        } = **closure;
         let body = match body.kind {
             ast::ExprKind::Block(ref block, _)
                 if !is_unsafe_block(block)
@@ -347,7 +347,15 @@ pub(crate) fn rewrite_last_closure(
             _ => body,
         };
         let (prefix, extra_offset) = rewrite_closure_fn_decl(
-            binder, capture, is_async, movability, fn_decl, body, expr.span, context, shape,
+            binder,
+            capture_clause,
+            asyncness,
+            movability,
+            fn_decl,
+            body,
+            expr.span,
+            context,
+            shape,
         )?;
         // If the closure goes multi line before its body, do not overflow the closure.
         if prefix.contains('\n') {
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs
index b4f1a178dbf..aba1c484bf1 100644
--- a/src/tools/rustfmt/src/expr.rs
+++ b/src/tools/rustfmt/src/expr.rs
@@ -116,7 +116,7 @@ pub(crate) fn format_expr(
             rewrite_struct_lit(
                 context,
                 path,
-                qself.as_ref(),
+                qself,
                 fields,
                 rest,
                 &expr.attrs,
@@ -169,7 +169,7 @@ pub(crate) fn format_expr(
             rewrite_match(context, cond, arms, shape, expr.span, &expr.attrs)
         }
         ast::ExprKind::Path(ref qself, ref path) => {
-            rewrite_path(context, PathContext::Expr, qself.as_ref(), path, shape)
+            rewrite_path(context, PathContext::Expr, qself, path, shape)
         }
         ast::ExprKind::Assign(ref lhs, ref rhs, _) => {
             rewrite_assignment(context, lhs, rhs, None, shape)
@@ -203,16 +203,16 @@ pub(crate) fn format_expr(
                 Some("yield".to_string())
             }
         }
-        ast::ExprKind::Closure(
-            ref binder,
-            capture,
-            ref is_async,
-            movability,
-            ref fn_decl,
-            ref body,
-            _,
-        ) => closures::rewrite_closure(
-            binder, capture, is_async, movability, fn_decl, body, expr.span, context, shape,
+        ast::ExprKind::Closure(ref cl) => closures::rewrite_closure(
+            &cl.binder,
+            cl.capture_clause,
+            &cl.asyncness,
+            cl.movability,
+            &cl.fn_decl,
+            &cl.body,
+            expr.span,
+            context,
+            shape,
         ),
         ast::ExprKind::Try(..)
         | ast::ExprKind::Field(..)
@@ -1537,7 +1537,7 @@ fn struct_lit_can_be_aligned(fields: &[ast::ExprField], has_base: bool) -> bool
 fn rewrite_struct_lit<'a>(
     context: &RewriteContext<'_>,
     path: &ast::Path,
-    qself: Option<&ast::QSelf>,
+    qself: &Option<ptr::P<ast::QSelf>>,
     fields: &'a [ast::ExprField],
     struct_rest: &ast::StructRest,
     attrs: &[ast::Attribute],
diff --git a/src/tools/rustfmt/src/patterns.rs b/src/tools/rustfmt/src/patterns.rs
index e2fe92b28f2..3f335172590 100644
--- a/src/tools/rustfmt/src/patterns.rs
+++ b/src/tools/rustfmt/src/patterns.rs
@@ -227,11 +227,10 @@ impl Rewrite for Pat {
             }
             PatKind::Tuple(ref items) => rewrite_tuple_pat(items, None, self.span, context, shape),
             PatKind::Path(ref q_self, ref path) => {
-                rewrite_path(context, PathContext::Expr, q_self.as_ref(), path, shape)
+                rewrite_path(context, PathContext::Expr, q_self, path, shape)
             }
             PatKind::TupleStruct(ref q_self, ref path, ref pat_vec) => {
-                let path_str =
-                    rewrite_path(context, PathContext::Expr, q_self.as_ref(), path, shape)?;
+                let path_str = rewrite_path(context, PathContext::Expr, q_self, path, shape)?;
                 rewrite_tuple_pat(pat_vec, Some(path_str), self.span, context, shape)
             }
             PatKind::Lit(ref expr) => expr.rewrite(context, shape),
@@ -271,7 +270,7 @@ impl Rewrite for Pat {
 }
 
 fn rewrite_struct_pat(
-    qself: &Option<ast::QSelf>,
+    qself: &Option<ptr::P<ast::QSelf>>,
     path: &ast::Path,
     fields: &[ast::PatField],
     ellipsis: bool,
@@ -281,7 +280,7 @@ fn rewrite_struct_pat(
 ) -> Option<String> {
     // 2 =  ` {`
     let path_shape = shape.sub_width(2)?;
-    let path_str = rewrite_path(context, PathContext::Expr, qself.as_ref(), path, path_shape)?;
+    let path_str = rewrite_path(context, PathContext::Expr, qself, path, path_shape)?;
 
     if fields.is_empty() && !ellipsis {
         return Some(format!("{} {{}}", path_str));
diff --git a/src/tools/rustfmt/src/types.rs b/src/tools/rustfmt/src/types.rs
index 2627886db10..d5177a2057b 100644
--- a/src/tools/rustfmt/src/types.rs
+++ b/src/tools/rustfmt/src/types.rs
@@ -38,11 +38,11 @@ pub(crate) enum PathContext {
 pub(crate) fn rewrite_path(
     context: &RewriteContext<'_>,
     path_context: PathContext,
-    qself: Option<&ast::QSelf>,
+    qself: &Option<ptr::P<ast::QSelf>>,
     path: &ast::Path,
     shape: Shape,
 ) -> Option<String> {
-    let skip_count = qself.map_or(0, |x| x.position);
+    let skip_count = qself.as_ref().map_or(0, |x| x.position);
 
     let mut result = if path.is_global() && qself.is_none() && path_context != PathContext::Import {
         "::".to_owned()
@@ -655,7 +655,7 @@ impl Rewrite for ast::PolyTraitRef {
 
 impl Rewrite for ast::TraitRef {
     fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
-        rewrite_path(context, PathContext::Type, None, &self.path, shape)
+        rewrite_path(context, PathContext::Type, &None, &self.path, shape)
     }
 }
 
@@ -800,7 +800,7 @@ impl Rewrite for ast::Ty {
                 rewrite_tuple(context, items.iter(), self.span, shape, items.len() == 1)
             }
             ast::TyKind::Path(ref q_self, ref path) => {
-                rewrite_path(context, PathContext::Type, q_self.as_ref(), path, shape)
+                rewrite_path(context, PathContext::Type, q_self, path, shape)
             }
             ast::TyKind::Array(ref ty, ref repeats) => rewrite_pair(
                 &**ty,
diff --git a/src/tools/rustfmt/src/utils.rs b/src/tools/rustfmt/src/utils.rs
index c47b3b314dd..136a2c7fce2 100644
--- a/src/tools/rustfmt/src/utils.rs
+++ b/src/tools/rustfmt/src/utils.rs
@@ -479,9 +479,9 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
         | ast::ExprKind::Binary(_, _, ref expr)
         | ast::ExprKind::Index(_, ref expr)
         | ast::ExprKind::Unary(_, ref expr)
-        | ast::ExprKind::Closure(_, _, _, _, _, ref expr, _)
         | ast::ExprKind::Try(ref expr)
         | ast::ExprKind::Yield(Some(ref expr)) => is_block_expr(context, expr, repr),
+        ast::ExprKind::Closure(ref closure) => is_block_expr(context, &closure.body, repr),
         // This can only be a string lit
         ast::ExprKind::Lit(_) => {
             repr.contains('\n') && trimmed_last_line_width(repr) <= context.config.tab_spaces()