From bb0b597f055eac3f5730f299e69048dc5f583ba6 Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 8 Jun 2017 20:16:18 +0200 Subject: [PATCH] Check for `for` loop desugaring in highering --- clippy_lints/src/utils/higher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index 5113f1224fe2..e736f2eae1f6 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -125,7 +125,7 @@ pub fn is_from_for_desugar(decl: &hir::Decl) -> bool { /// `for pat in arg { body }` becomes `(pat, arg, body)`. pub fn for_loop(expr: &hir::Expr) -> Option<(&hir::Pat, &hir::Expr, &hir::Expr)> { if_let_chain! {[ - let hir::ExprMatch(ref iterexpr, ref arms, _) = expr.node, + let hir::ExprMatch(ref iterexpr, ref arms, hir::MatchSource::ForLoopDesugar) = expr.node, let hir::ExprCall(_, ref iterargs) = iterexpr.node, iterargs.len() == 1 && arms.len() == 1 && arms[0].guard.is_none(), let hir::ExprLoop(ref block, _, _) = arms[0].body.node,