From 1d2772c2c7dc0a42d8a9429d24ea41412add61b3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 14 Jun 2021 13:15:05 +0300 Subject: internal: move diagnostics to a new crate --- .../ide/src/diagnostics/break_outside_of_loop.rs | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 crates/ide/src/diagnostics/break_outside_of_loop.rs (limited to 'crates/ide/src/diagnostics/break_outside_of_loop.rs') 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 @@ -use crate::diagnostics::{Diagnostic, DiagnosticsContext}; - -// Diagnostic: break-outside-of-loop -// -// This diagnostic is triggered if the `break` keyword is used outside of a loop. -pub(super) fn break_outside_of_loop( - ctx: &DiagnosticsContext<'_>, - d: &hir::BreakOutsideOfLoop, -) -> Diagnostic { - Diagnostic::new( - "break-outside-of-loop", - "break outside of loop", - ctx.sema.diagnostics_display_range(d.expr.clone().map(|it| it.into())).range, - ) -} - -#[cfg(test)] -mod tests { - use crate::diagnostics::tests::check_diagnostics; - - #[test] - fn break_outside_of_loop() { - check_diagnostics( - r#" -fn foo() { break; } - //^^^^^ break outside of loop -"#, - ); - } -} -- cgit v1.2.3