Skip to content

Commit

Permalink
Check for for loop desugaring in highering
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarton committed Jun 8, 2017
1 parent 07c25ea commit bb0b597
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 bb0b597

Please sign in to comment.