Skip to content

Commit c06f8d0

Browse files
committed
Auto merge of #4604 - Manishearth:rustup, r=yaahc
Rustup to rustc 1.40.0-nightly (702b45e 2019-10-01) Broken by rust-lang/rust#64825 r? @yaahc @phansch
2 parents 406e89a + 9e166e0 commit c06f8d0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

clippy_lints/src/loops.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,21 @@ declare_lint_pass!(Loops => [
476476
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Loops {
477477
#[allow(clippy::too_many_lines)]
478478
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
479+
if let Some((pat, arg, body)) = higher::for_loop(expr) {
480+
// we don't want to check expanded macros
481+
// this check is not at the top of the function
482+
// since higher::for_loop expressions are marked as expansions
483+
if body.span.from_expansion() {
484+
return;
485+
}
486+
check_for_loop(cx, pat, arg, body, expr);
487+
}
488+
479489
// we don't want to check expanded macros
480490
if expr.span.from_expansion() {
481491
return;
482492
}
483493

484-
if let Some((pat, arg, body)) = higher::for_loop(expr) {
485-
check_for_loop(cx, pat, arg, body, expr);
486-
}
487-
488494
// check for never_loop
489495
if let ExprKind::Loop(ref block, _, _) = expr.kind {
490496
match never_loop_block(block, expr.hir_id) {
@@ -1039,10 +1045,6 @@ fn check_for_loop_range<'a, 'tcx>(
10391045
body: &'tcx Expr,
10401046
expr: &'tcx Expr,
10411047
) {
1042-
if expr.span.from_expansion() {
1043-
return;
1044-
}
1045-
10461048
if let Some(higher::Range {
10471049
start: Some(start),
10481050
ref end,

0 commit comments

Comments
 (0)