This commit is contained in:
Raiki Tamura
2023-01-07 20:44:02 +09:00
parent 79ed23ff81
commit ce56cf71d9
2 changed files with 12 additions and 13 deletions

View File

@@ -724,3 +724,14 @@ pub fn for_each_local_assignment<'tcx, B>(
ControlFlow::Continue(())
}
}
pub fn contains_break_or_continue(expr: &Expr<'_>) -> bool {
for_each_expr(expr, |e| {
if matches!(e.kind, ExprKind::Break(..) | ExprKind::Continue(..)) {
ControlFlow::Break(())
} else {
ControlFlow::Continue(())
}
})
.is_some()
}