aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-13 18:13:15 +0100
committerAleksey Kladov <[email protected]>2021-06-13 18:14:12 +0100
commit74f3cca85ab870614f314c6180e2fbb883ad4fe3 (patch)
tree69f0f7aac85ae2fe0a6907a956b94b0bd434ea7e /crates/ide/src/diagnostics.rs
parent8d391ec981562785ec92ce3afe950972c523f925 (diff)
internal: refactor remove this semicolon diagnostics
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 4c92d0cf4..3ced08f30 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -11,6 +11,7 @@ mod mismatched_arg_count;
11mod missing_fields; 11mod missing_fields;
12mod missing_unsafe; 12mod missing_unsafe;
13mod no_such_field; 13mod no_such_field;
14mod remove_this_semicolon;
14mod unimplemented_builtin_macro; 15mod unimplemented_builtin_macro;
15mod unresolved_extern_crate; 16mod unresolved_extern_crate;
16mod unresolved_import; 17mod unresolved_import;
@@ -165,9 +166,6 @@ pub(crate) fn diagnostics(
165 .on::<hir::diagnostics::MissingOkOrSomeInTailExpr, _>(|d| { 166 .on::<hir::diagnostics::MissingOkOrSomeInTailExpr, _>(|d| {
166 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve)); 167 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve));
167 }) 168 })
168 .on::<hir::diagnostics::RemoveThisSemicolon, _>(|d| {
169 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve));
170 })
171 .on::<hir::diagnostics::IncorrectCase, _>(|d| { 169 .on::<hir::diagnostics::IncorrectCase, _>(|d| {
172 res.borrow_mut().push(warning_with_fix(d, &sema, resolve)); 170 res.borrow_mut().push(warning_with_fix(d, &sema, resolve));
173 }) 171 })
@@ -223,10 +221,11 @@ pub(crate) fn diagnostics(
223 let d = match diag { 221 let d = match diag {
224 AnyDiagnostic::BreakOutsideOfLoop(d) => break_outside_of_loop::break_outside_of_loop(&ctx, &d), 222 AnyDiagnostic::BreakOutsideOfLoop(d) => break_outside_of_loop::break_outside_of_loop(&ctx, &d),
225 AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d), 223 AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d),
224 AnyDiagnostic::MismatchedArgCount(d) => mismatched_arg_count::mismatched_arg_count(&ctx, &d),
226 AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d), 225 AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d),
227 AnyDiagnostic::MissingUnsafe(d) => missing_unsafe::missing_unsafe(&ctx, &d), 226 AnyDiagnostic::MissingUnsafe(d) => missing_unsafe::missing_unsafe(&ctx, &d),
228 AnyDiagnostic::MismatchedArgCount(d) => mismatched_arg_count::mismatched_arg_count(&ctx, &d),
229 AnyDiagnostic::NoSuchField(d) => no_such_field::no_such_field(&ctx, &d), 227 AnyDiagnostic::NoSuchField(d) => no_such_field::no_such_field(&ctx, &d),
228 AnyDiagnostic::RemoveThisSemicolon(d) => remove_this_semicolon::remove_this_semicolon(&ctx, &d),
230 AnyDiagnostic::UnimplementedBuiltinMacro(d) => unimplemented_builtin_macro::unimplemented_builtin_macro(&ctx, &d), 229 AnyDiagnostic::UnimplementedBuiltinMacro(d) => unimplemented_builtin_macro::unimplemented_builtin_macro(&ctx, &d),
231 AnyDiagnostic::UnresolvedExternCrate(d) => unresolved_extern_crate::unresolved_extern_crate(&ctx, &d), 230 AnyDiagnostic::UnresolvedExternCrate(d) => unresolved_extern_crate::unresolved_extern_crate(&ctx, &d),
232 AnyDiagnostic::UnresolvedImport(d) => unresolved_import::unresolved_import(&ctx, &d), 231 AnyDiagnostic::UnresolvedImport(d) => unresolved_import::unresolved_import(&ctx, &d),
@@ -839,16 +838,6 @@ fn x(a: S) {
839 } 838 }
840 839
841 #[test] 840 #[test]
842 fn missing_semicolon() {
843 check_diagnostics(
844 r#"
845 fn test() -> i32 { 123; }
846 //^^^ Remove this semicolon
847 "#,
848 );
849 }
850
851 #[test]
852 fn import_extern_crate_clash_with_inner_item() { 841 fn import_extern_crate_clash_with_inner_item() {
853 // This is more of a resolver test, but doesn't really work with the hir_def testsuite. 842 // This is more of a resolver test, but doesn't really work with the hir_def testsuite.
854 843