aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 075aae8d5..3307e240b 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -5,6 +5,7 @@
5//! original files. So we need to map the ranges. 5//! original files. So we need to map the ranges.
6 6
7mod unresolved_module; 7mod unresolved_module;
8mod missing_fields;
8 9
9mod fixes; 10mod fixes;
10mod field_shorthand; 11mod field_shorthand;
@@ -123,9 +124,6 @@ pub(crate) fn diagnostics(
123 } 124 }
124 let res = RefCell::new(res); 125 let res = RefCell::new(res);
125 let sink_builder = DiagnosticSinkBuilder::new() 126 let sink_builder = DiagnosticSinkBuilder::new()
126 .on::<hir::diagnostics::MissingFields, _>(|d| {
127 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve));
128 })
129 .on::<hir::diagnostics::MissingOkOrSomeInTailExpr, _>(|d| { 127 .on::<hir::diagnostics::MissingOkOrSomeInTailExpr, _>(|d| {
130 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve)); 128 res.borrow_mut().push(diagnostic_with_fix(d, &sema, resolve));
131 }) 129 })
@@ -232,7 +230,8 @@ pub(crate) fn diagnostics(
232 let ctx = DiagnosticsContext { config, sema, resolve }; 230 let ctx = DiagnosticsContext { config, sema, resolve };
233 for diag in diags { 231 for diag in diags {
234 let d = match diag { 232 let d = match diag {
235 AnyDiagnostic::UnresolvedModule(d) => unresolved_module::render(&ctx, &d), 233 AnyDiagnostic::UnresolvedModule(d) => unresolved_module::unresolved_module(&ctx, &d),
234 AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d),
236 }; 235 };
237 if let Some(code) = d.code { 236 if let Some(code) = d.code {
238 if ctx.config.disabled.contains(code.as_str()) { 237 if ctx.config.disabled.contains(code.as_str()) {
@@ -1057,20 +1056,6 @@ fn main() {
1057 } 1056 }
1058 1057
1059 #[test] 1058 #[test]
1060 fn missing_record_pat_field_diagnostic() {
1061 check_diagnostics(
1062 r#"
1063struct S { foo: i32, bar: () }
1064fn baz(s: S) {
1065 let S { foo: _ } = s;
1066 //^ Missing structure fields:
1067 //| - bar
1068}
1069"#,
1070 );
1071 }
1072
1073 #[test]
1074 fn missing_record_pat_field_no_diagnostic_if_not_exhaustive() { 1059 fn missing_record_pat_field_no_diagnostic_if_not_exhaustive() {
1075 check_diagnostics( 1060 check_diagnostics(
1076 r" 1061 r"