aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-13 17:51:19 +0100
committerAleksey Kladov <[email protected]>2021-06-13 17:51:19 +0100
commit886b66cd03cbe7cb13e248d7c7bbdeba66c7796a (patch)
tree4479618bebc4f3b6bcc6159ad887cfc1591091b4 /crates/ide/src/diagnostics.rs
parent7166e8549bad95b05f66acd508d07a6cd97d3dc0 (diff)
internal: refactor BreakOutsideOfLoop diagnostic
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs12
1 files changed, 2 insertions, 10 deletions
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 @@
4//! macro-expanded files, but we need to present them to the users in terms of 4//! macro-expanded files, but we need to present them to the users in terms of
5//! original files. So we need to map the ranges. 5//! original files. So we need to map the ranges.
6 6
7mod break_outside_of_loop;
7mod inactive_code; 8mod inactive_code;
8mod macro_error; 9mod macro_error;
9mod missing_fields; 10mod missing_fields;
@@ -218,6 +219,7 @@ pub(crate) fn diagnostics(
218 for diag in diags { 219 for diag in diags {
219 #[rustfmt::skip] 220 #[rustfmt::skip]
220 let d = match diag { 221 let d = match diag {
222 AnyDiagnostic::BreakOutsideOfLoop(d) => break_outside_of_loop::break_outside_of_loop(&ctx, &d),
221 AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d), 223 AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d),
222 AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d), 224 AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d),
223 AnyDiagnostic::NoSuchField(d) => no_such_field::no_such_field(&ctx, &d), 225 AnyDiagnostic::NoSuchField(d) => no_such_field::no_such_field(&ctx, &d),
@@ -712,16 +714,6 @@ mod foo;
712 } 714 }
713 715
714 #[test] 716 #[test]
715 fn break_outside_of_loop() {
716 check_diagnostics(
717 r#"
718fn foo() { break; }
719 //^^^^^ break outside of loop
720"#,
721 );
722 }
723
724 #[test]
725 fn missing_unsafe_diagnostic_with_raw_ptr() { 717 fn missing_unsafe_diagnostic_with_raw_ptr() {
726 check_diagnostics( 718 check_diagnostics(
727 r#" 719 r#"