diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-26 13:30:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-26 13:30:44 +0100 |
commit | 3882231f3231db03144107f72c6052f773fe2375 (patch) | |
tree | 6f318218b3a97c9a2dba3e8311de4fddbce23b27 /crates/ra_ide_api | |
parent | d6bbdfefa7ed4b2b567558e76d5adadda9d9b83f (diff) | |
parent | 183a38fb50f284de1ca02c05ed945e240f3c0274 (diff) |
Merge #1918
1918: keep ast creation API simple r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/diagnostics.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index f07061e99..144bc0a70 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs | |||
@@ -2,11 +2,11 @@ use std::cell::RefCell; | |||
2 | 2 | ||
3 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; | 3 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; |
4 | use itertools::Itertools; | 4 | use itertools::Itertools; |
5 | use ra_assists::{ast_builder::Make, ast_editor::AstEditor}; | 5 | use ra_assists::ast_editor::AstEditor; |
6 | use ra_db::SourceDatabase; | 6 | use ra_db::SourceDatabase; |
7 | use ra_prof::profile; | 7 | use ra_prof::profile; |
8 | use ra_syntax::{ | 8 | use ra_syntax::{ |
9 | ast::{self, AstNode}, | 9 | ast::{self, make, AstNode}, |
10 | Location, SyntaxNode, TextRange, T, | 10 | Location, SyntaxNode, TextRange, T, |
11 | }; | 11 | }; |
12 | use ra_text_edit::{TextEdit, TextEditBuilder}; | 12 | use ra_text_edit::{TextEdit, TextEditBuilder}; |
@@ -59,10 +59,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> | |||
59 | let node = d.ast(db); | 59 | let node = d.ast(db); |
60 | let mut ast_editor = AstEditor::new(node); | 60 | let mut ast_editor = AstEditor::new(node); |
61 | for f in d.missed_fields.iter() { | 61 | for f in d.missed_fields.iter() { |
62 | let field = Make::<ast::RecordField>::from( | 62 | let field = make::record_field(make::name_ref(&f.to_string()), Some(make::expr_unit())); |
63 | Make::<ast::NameRef>::from(&f.to_string()), | ||
64 | Some(Make::<ast::Expr>::unit()), | ||
65 | ); | ||
66 | ast_editor.append_field(&field); | 63 | ast_editor.append_field(&field); |
67 | } | 64 | } |
68 | 65 | ||