]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/blocks_in_if_conditions.rs
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
[rust.git] / src / tools / clippy / clippy_lints / src / blocks_in_if_conditions.rs
index 51d95cc6f0b10b485c2f94e3fd10b200e9bb8442..47e5b0d583dabcee654d1613e6057a06459f5112 100644 (file)
@@ -61,8 +61,8 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
             // do not lint if the closure is called using an iterator (see #1141)
             if_chain! {
                 if let Some(parent) = get_parent_expr(self.cx, expr);
-                if let ExprKind::MethodCall(_, _, args, _) = parent.kind;
-                let caller = self.cx.typeck_results().expr_ty(&args[0]);
+                if let ExprKind::MethodCall(_, _, [self_arg, ..], _) = &parent.kind;
+                let caller = self.cx.typeck_results().expr_ty(self_arg);
                 if let Some(iter_id) = self.cx.tcx.get_diagnostic_item(sym::Iterator);
                 if implements_trait(self.cx, caller, iter_id, &[]);
                 then {