diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index c50a70d99..3264f8f80 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -66,6 +66,14 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> | |||
66 | .on::<hir::diagnostics::MissingFields, _>(|d| { | 66 | .on::<hir::diagnostics::MissingFields, _>(|d| { |
67 | let mut field_list = d.ast(db); | 67 | let mut field_list = d.ast(db); |
68 | for f in d.missed_fields.iter() { | 68 | for f in d.missed_fields.iter() { |
69 | // Note that although we could add a diagnostics to | ||
70 | // fill the missing tuple field, e.g : | ||
71 | // `struct A(usize);` | ||
72 | // `let a = A { 0: () }` | ||
73 | // but it is uncommon usage and it should not be encouraged. | ||
74 | if f.as_tuple_index().is_some() { | ||
75 | continue; | ||
76 | } | ||
69 | let field = make::record_field(make::name_ref(&f.to_string()), Some(make::expr_unit())); | 77 | let field = make::record_field(make::name_ref(&f.to_string()), Some(make::expr_unit())); |
70 | field_list = field_list.append_field(&field); | 78 | field_list = field_list.append_field(&field); |
71 | } | 79 | } |