diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 10b4633a3b2..9615025fa57 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -900,8 +900,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let mut closure_span = None::; match expr.kind { hir::ExprKind::MethodCall(.., args, _) => { - // only the first closre parameter of the method. args[0] is MethodCall PathSegment - for arg in args { if let hir::ExprKind::Closure(hir::Closure { capture_clause: hir::CaptureBy::Ref, diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 01df564a7c2..8fa5d610ffa 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -3498,7 +3498,7 @@ mod size_asserts { static_assert_size!(Block<'_>, 48); static_assert_size!(Body<'_>, 32); static_assert_size!(Expr<'_>, 64); - static_assert_size!(ExprKind<'_>, 40); + static_assert_size!(ExprKind<'_>, 48); static_assert_size!(FnDecl<'_>, 40); static_assert_size!(ForeignItem<'_>, 72); static_assert_size!(ForeignItemKind<'_>, 40); diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index a9ea79c2fe3..6a4cd79cde7 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1041,10 +1041,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprKind::MethodCall(.., receiver, ref args, _) => { let succ = self.check_is_ty_uninhabited(expr, succ); - let succ = args - .iter() - .rev() - .fold(succ, |succ, expr| self.propagate_through_expr(expr, succ)); + let succ = self.propagate_through_exprs(args, succ); self.propagate_through_expr(receiver, succ) } diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr index 78f70997555..0a736f7be83 100644 --- a/src/test/ui/stats/hir-stats.stderr +++ b/src/test/ui/stats/hir-stats.stderr @@ -121,15 +121,15 @@ hir-stats ---------------------------------------------------------------- hir-stats ForeignItemRef 24 ( 0.2%) 1 24 hir-stats Mod 32 ( 0.3%) 1 32 hir-stats ExprField 40 ( 0.4%) 1 40 -hir-stats TraitItemRef 56 ( 0.6%) 2 28 +hir-stats TraitItemRef 56 ( 0.5%) 2 28 hir-stats Param 64 ( 0.6%) 2 32 hir-stats Local 64 ( 0.6%) 1 64 hir-stats InlineAsm 72 ( 0.7%) 1 72 hir-stats ImplItemRef 72 ( 0.7%) 2 36 -hir-stats FieldDef 96 ( 1.0%) 2 48 -hir-stats Arm 96 ( 1.0%) 2 48 -hir-stats Body 96 ( 1.0%) 3 32 -hir-stats Stmt 96 ( 1.0%) 3 32 +hir-stats FieldDef 96 ( 0.9%) 2 48 +hir-stats Arm 96 ( 0.9%) 2 48 +hir-stats Body 96 ( 0.9%) 3 32 +hir-stats Stmt 96 ( 0.9%) 3 32 hir-stats - Local 32 ( 0.3%) 1 hir-stats - Semi 32 ( 0.3%) 1 hir-stats - Expr 32 ( 0.3%) 1 @@ -144,34 +144,34 @@ hir-stats GenericBound 192 ( 1.9%) 4 48 hir-stats - Trait 192 ( 1.9%) 4 hir-stats WherePredicate 216 ( 2.1%) 3 72 hir-stats - BoundPredicate 216 ( 2.1%) 3 -hir-stats Block 288 ( 2.9%) 6 48 -hir-stats GenericParam 400 ( 4.0%) 5 80 -hir-stats Pat 440 ( 4.4%) 5 88 +hir-stats Block 288 ( 2.8%) 6 48 +hir-stats GenericParam 400 ( 3.9%) 5 80 +hir-stats Pat 440 ( 4.3%) 5 88 hir-stats - Wild 88 ( 0.9%) 1 hir-stats - Struct 88 ( 0.9%) 1 hir-stats - Binding 264 ( 2.6%) 3 hir-stats Generics 560 ( 5.5%) 10 56 -hir-stats Expr 672 ( 6.7%) 12 56 -hir-stats - Path 56 ( 0.6%) 1 -hir-stats - Struct 56 ( 0.6%) 1 -hir-stats - Match 56 ( 0.6%) 1 -hir-stats - InlineAsm 56 ( 0.6%) 1 -hir-stats - Lit 112 ( 1.1%) 2 -hir-stats - Block 336 ( 3.3%) 6 -hir-stats Item 960 ( 9.5%) 12 80 +hir-stats Expr 768 ( 7.5%) 12 64 +hir-stats - Path 64 ( 0.6%) 1 +hir-stats - Struct 64 ( 0.6%) 1 +hir-stats - Match 64 ( 0.6%) 1 +hir-stats - InlineAsm 64 ( 0.6%) 1 +hir-stats - Lit 128 ( 1.3%) 2 +hir-stats - Block 384 ( 3.8%) 6 +hir-stats Item 960 ( 9.4%) 12 80 hir-stats - Trait 80 ( 0.8%) 1 hir-stats - Enum 80 ( 0.8%) 1 hir-stats - ExternCrate 80 ( 0.8%) 1 hir-stats - ForeignMod 80 ( 0.8%) 1 hir-stats - Impl 80 ( 0.8%) 1 hir-stats - Fn 160 ( 1.6%) 2 -hir-stats - Use 400 ( 4.0%) 5 -hir-stats Ty 1_080 (10.7%) 15 72 +hir-stats - Use 400 ( 3.9%) 5 +hir-stats Ty 1_080 (10.6%) 15 72 hir-stats - Ptr 72 ( 0.7%) 1 hir-stats - Rptr 72 ( 0.7%) 1 -hir-stats - Path 936 ( 9.3%) 13 -hir-stats Path 1_536 (15.2%) 32 48 -hir-stats PathSegment 2_240 (22.2%) 40 56 +hir-stats - Path 936 ( 9.2%) 13 +hir-stats Path 1_536 (15.1%) 32 48 +hir-stats PathSegment 2_240 (22.0%) 40 56 hir-stats ---------------------------------------------------------------- -hir-stats Total 10_104 +hir-stats Total 10_200 hir-stats diff --git a/src/tools/clippy/clippy_lints/src/eta_reduction.rs b/src/tools/clippy/clippy_lints/src/eta_reduction.rs index 1c0a93c71fd..1342a4697b9 100644 --- a/src/tools/clippy/clippy_lints/src/eta_reduction.rs +++ b/src/tools/clippy/clippy_lints/src/eta_reduction.rs @@ -206,12 +206,8 @@ fn check_inputs( _ => false, } }; - if let Some(receiver) = receiver { - std::iter::zip(params, std::iter::once(receiver).chain(call_args.iter())) - .all(|(param, arg)| check_inputs(param, arg)) - } else { - std::iter::zip(params, call_args).all(|(param, arg)| check_inputs(param, arg)) - } + std::iter::zip(params, receiver.into_iter().chain(call_args.iter())) + .all(|(param, arg)| check_inputs(param, arg)) } fn check_sig<'tcx>(cx: &LateContext<'tcx>, closure_ty: Ty<'tcx>, call_ty: Ty<'tcx>) -> bool {