diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-25 13:59:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-25 13:59:12 +0100 |
commit | bb467b857eabb0c930316ff066b30c395d7fa63b (patch) | |
tree | a836a030fb899cfcff96e08fa37420560a160133 /crates/ra_ide_api | |
parent | 8f92309dbc00a0f88563030921706f205c01f452 (diff) | |
parent | efeae82f5221d2fdeeeed0bc67a2234647e160dd (diff) |
Merge #1910
1910: Assists r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/diagnostics.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 30b95a215..f07061e99 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::AstBuilder, ast_editor::AstEditor}; | 5 | use ra_assists::{ast_builder::Make, 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, RecordField}, | 9 | ast::{self, 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,7 +59,11 @@ 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 | ast_editor.append_field(&AstBuilder::<RecordField>::from_name(f)); | 62 | let field = Make::<ast::RecordField>::from( |
63 | Make::<ast::NameRef>::from(&f.to_string()), | ||
64 | Some(Make::<ast::Expr>::unit()), | ||
65 | ); | ||
66 | ast_editor.append_field(&field); | ||
63 | } | 67 | } |
64 | 68 | ||
65 | let mut builder = TextEditBuilder::default(); | 69 | let mut builder = TextEditBuilder::default(); |