diff options
| author | Raiki Tamura <tamaron1203@gmail.com> | 2023-01-07 20:44:02 +0900 |
|---|---|---|
| committer | Raiki Tamura <tamaron1203@gmail.com> | 2023-01-07 20:44:02 +0900 |
| commit | ce56cf71d956ea78c319ff510651473ca8dce47c (patch) | |
| tree | d67abc52e8a86e8a8d17241cc4de24b1e5cf345d /clippy_utils | |
| parent | 79ed23ff815bc39d0062ade40b2c38dd37e77373 (diff) | |
chore
Diffstat (limited to 'clippy_utils')
| -rw-r--r-- | clippy_utils/src/visitors.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clippy_utils/src/visitors.rs b/clippy_utils/src/visitors.rs index 863fb60fcfc..14c01a60b4c 100644 --- a/clippy_utils/src/visitors.rs +++ b/clippy_utils/src/visitors.rs @@ -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() +} |
