]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_utils/src/visitors.rs
Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk
[rust.git] / src / tools / clippy / clippy_utils / src / visitors.rs
index 863fb60fcfca1fb09aee2de418dcd9c0743d7855..14c01a60b4c32b775e7aa5cce1ce9a242b363fd7 100644 (file)
@@ -724,3 +724,14 @@ fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) {
         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()
+}