Skip to content

Commit

Permalink
Merge pull request rust-lang#1819 from Manishearth/fix-1814
Browse files Browse the repository at this point in the history
Check for `for` loop desugaring in highering
  • Loading branch information
mcarton committed Jun 8, 2017
2 parents 07c25ea + bb0b597 commit 3cbf126
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/higher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3cbf126

Please sign in to comment.