From 6c8a6c18ab3639c9f33bbc2fa39eaef97e6c6aac Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Fri, 17 Feb 2017 08:49:34 +0100 Subject: [PATCH] deal with binary op short-circuit --- clippy_lints/src/loops.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 2b175d14afd..d7f952255fe 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -448,13 +448,13 @@ fn never_loop_expr(expr: &Expr) -> bool { ExprBreak(..) | ExprRet(..) => true, ExprBox(ref e) | ExprUnary(_, ref e) | + ExprBinary(_, ref e, _) | // because short-circuiting ExprCast(ref e, _) | ExprType(ref e, _) | ExprField(ref e, _) | ExprTupField(ref e, _) | ExprRepeat(ref e, _) | ExprAddrOf(_, ref e) => never_loop_expr(e), - ExprBinary(_, ref e1, ref e2) | ExprAssign(ref e1, ref e2) | ExprAssignOp(_, ref e1, ref e2) | ExprIndex(ref e1, ref e2) => never_loop_expr(e1) || never_loop_expr(e2),