From 886b66cd03cbe7cb13e248d7c7bbdeba66c7796a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 19:51:19 +0300 Subject: internal: refactor BreakOutsideOfLoop diagnostic --- crates/ide/src/diagnostics.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'crates/ide/src/diagnostics.rs') diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index caaa89e0a..e8f22c889 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -4,6 +4,7 @@ //! macro-expanded files, but we need to present them to the users in terms of //! original files. So we need to map the ranges. +mod break_outside_of_loop; mod inactive_code; mod macro_error; mod missing_fields; @@ -218,6 +219,7 @@ pub(crate) fn diagnostics( for diag in diags { #[rustfmt::skip] let d = match diag { + AnyDiagnostic::BreakOutsideOfLoop(d) => break_outside_of_loop::break_outside_of_loop(&ctx, &d), AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d), AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d), AnyDiagnostic::NoSuchField(d) => no_such_field::no_such_field(&ctx, &d), @@ -711,16 +713,6 @@ mod foo; ); } - #[test] - fn break_outside_of_loop() { - check_diagnostics( - r#" -fn foo() { break; } - //^^^^^ break outside of loop -"#, - ); - } - #[test] fn missing_unsafe_diagnostic_with_raw_ptr() { check_diagnostics( -- cgit v1.2.3