cleaned up record field builder

This commit is contained in:
Aleksey Kladov 2019-09-25 15:09:03 +03:00
parent 69689625ce
commit 25fca04753
2 changed files with 4 additions and 7 deletions

View file

@ -59,7 +59,9 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
let node = d.ast(db);
let mut ast_editor = AstEditor::new(node);
for f in d.missed_fields.iter() {
ast_editor.append_field(&AstBuilder::<RecordField>::from_name(f));
let name_ref = AstBuilder::<ast::NameRef>::new(&f.to_string());
let unit = AstBuilder::<ast::Expr>::unit();
ast_editor.append_field(&AstBuilder::<RecordField>::from_pieces(name_ref, Some(unit)));
}
let mut builder = TextEditBuilder::default();