aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics/break_outside_of_loop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/diagnostics/break_outside_of_loop.rs')
-rw-r--r--crates/ide/src/diagnostics/break_outside_of_loop.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/crates/ide/src/diagnostics/break_outside_of_loop.rs b/crates/ide/src/diagnostics/break_outside_of_loop.rs
deleted file mode 100644
index 80e68f3cc..000000000
--- a/crates/ide/src/diagnostics/break_outside_of_loop.rs
+++ /dev/null
@@ -1,30 +0,0 @@
1use crate::diagnostics::{Diagnostic, DiagnosticsContext};
2
3// Diagnostic: break-outside-of-loop
4//
5// This diagnostic is triggered if the `break` keyword is used outside of a loop.
6pub(super) fn break_outside_of_loop(
7 ctx: &DiagnosticsContext<'_>,
8 d: &hir::BreakOutsideOfLoop,
9) -> Diagnostic {
10 Diagnostic::new(
11 "break-outside-of-loop",
12 "break outside of loop",
13 ctx.sema.diagnostics_display_range(d.expr.clone().map(|it| it.into())).range,
14 )
15}
16
17#[cfg(test)]
18mod tests {
19 use crate::diagnostics::tests::check_diagnostics;
20
21 #[test]
22 fn break_outside_of_loop() {
23 check_diagnostics(
24 r#"
25fn foo() { break; }
26 //^^^^^ break outside of loop
27"#,
28 );
29 }
30}