Skip to content

Commit bc3cd34

Browse files
committed
fix clippy suggestions
1 parent 036a010 commit bc3cd34

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/loops/never_loop.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn stmt_to_expr<'tcx>(stmt: &Stmt<'tcx>) -> Option<(&'tcx Expr<'tcx>, Option<&'t
118118
}
119119
}
120120

121+
#[allow(clippy::too_many_lines)]
121122
fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: HirId) -> NeverLoopResult {
122123
match expr.kind {
123124
ExprKind::Box(e)
@@ -170,7 +171,7 @@ fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: H
170171
}
171172
},
172173
ExprKind::Block(b, l) => {
173-
if let Some(_) = l {
174+
if l.is_some() {
174175
ignore_ids.push(b.hir_id);
175176
}
176177
let ret = never_loop_block(b, ignore_ids, main_loop_id);
@@ -187,6 +188,7 @@ fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: H
187188
NeverLoopResult::AlwaysBreak
188189
}
189190
},
191+
// checks if break targets a block instead of a loop
190192
ExprKind::Break(Destination { target_id: Ok(t), .. }, e) if ignore_ids.contains(&t) => e
191193
.map_or(NeverLoopResult::Otherwise, |e| {
192194
combine_seq(never_loop_expr(e, ignore_ids, main_loop_id), NeverLoopResult::Otherwise)

0 commit comments

Comments
 (0)