From 25fca0475343170b8398f5c87c76c455205ed3c4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Sep 2019 15:09:03 +0300 Subject: cleaned up record field builder --- crates/ra_ide_api/src/diagnostics.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide_api/src/diagnostics.rs') diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 30b95a215..6602fd27e 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -59,7 +59,9 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec let node = d.ast(db); let mut ast_editor = AstEditor::new(node); for f in d.missed_fields.iter() { - ast_editor.append_field(&AstBuilder::::from_name(f)); + let name_ref = AstBuilder::::new(&f.to_string()); + let unit = AstBuilder::::unit(); + ast_editor.append_field(&AstBuilder::::from_pieces(name_ref, Some(unit))); } let mut builder = TextEditBuilder::default(); -- cgit v1.2.3 From 32843ae6f7f91cea88edcec428cb5bad07bd5e98 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Sep 2019 15:28:26 +0300 Subject: shorten AstBuilder names --- crates/ra_ide_api/src/diagnostics.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide_api/src/diagnostics.rs') diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 6602fd27e..06e7ea6da 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; use itertools::Itertools; -use ra_assists::{ast_builder::AstBuilder, ast_editor::AstEditor}; +use ra_assists::{ast_builder::Make, ast_editor::AstEditor}; use ra_db::SourceDatabase; use ra_prof::profile; use ra_syntax::{ @@ -59,9 +59,9 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec let node = d.ast(db); let mut ast_editor = AstEditor::new(node); for f in d.missed_fields.iter() { - let name_ref = AstBuilder::::new(&f.to_string()); - let unit = AstBuilder::::unit(); - ast_editor.append_field(&AstBuilder::::from_pieces(name_ref, Some(unit))); + let name_ref = Make::::new(&f.to_string()); + let unit = Make::::unit(); + ast_editor.append_field(&Make::::from(name_ref, Some(unit))); } let mut builder = TextEditBuilder::default(); -- cgit v1.2.3 From 98639d835c7d37724b67f1ebd30c99bc2c3d8478 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Sep 2019 15:39:41 +0300 Subject: cleanup diagnostics --- crates/ra_ide_api/src/diagnostics.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide_api/src/diagnostics.rs') diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 06e7ea6da..836e15a4b 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -6,7 +6,7 @@ use ra_assists::{ast_builder::Make, ast_editor::AstEditor}; use ra_db::SourceDatabase; use ra_prof::profile; use ra_syntax::{ - ast::{self, AstNode, RecordField}, + ast::{self, AstNode}, Location, SyntaxNode, TextRange, T, }; use ra_text_edit::{TextEdit, TextEditBuilder}; @@ -59,9 +59,11 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec let node = d.ast(db); let mut ast_editor = AstEditor::new(node); for f in d.missed_fields.iter() { - let name_ref = Make::::new(&f.to_string()); - let unit = Make::::unit(); - ast_editor.append_field(&Make::::from(name_ref, Some(unit))); + let field = Make::::from( + Make::::new(&f.to_string()), + Some(Make::::unit()), + ); + ast_editor.append_field(&field); } let mut builder = TextEditBuilder::default(); -- cgit v1.2.3 From efeae82f5221d2fdeeeed0bc67a2234647e160dd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Sep 2019 15:58:40 +0300 Subject: clean up naming --- crates/ra_ide_api/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_ide_api/src/diagnostics.rs') diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 836e15a4b..f07061e99 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -60,7 +60,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec let mut ast_editor = AstEditor::new(node); for f in d.missed_fields.iter() { let field = Make::::from( - Make::::new(&f.to_string()), + Make::::from(&f.to_string()), Some(Make::::unit()), ); ast_editor.append_field(&field); -- cgit v1.2.3