From 6f8aa75329d0a4e588e58b8f22f7932bf3d3a706 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:21:30 +0200 Subject: Rename RecordLit -> RecordExpr --- crates/ra_ide/src/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide/src/diagnostics.rs') diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 897177d05..efbb00d6d 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -146,7 +146,7 @@ fn missing_struct_field_fix( ) -> Option { let record_expr = sema.ast(d); - let record_lit = ast::RecordLit::cast(record_expr.syntax().parent()?.parent()?)?; + let record_lit = ast::RecordExpr::cast(record_expr.syntax().parent()?.parent()?)?; let def_id = sema.resolve_variant(record_lit)?; let module; let def_file_id; @@ -263,8 +263,8 @@ fn check_struct_shorthand_initialization( file_id: FileId, node: &SyntaxNode, ) -> Option<()> { - let record_lit = ast::RecordLit::cast(node.clone())?; - let record_field_list = record_lit.record_field_list()?; + let record_lit = ast::RecordExpr::cast(node.clone())?; + let record_field_list = record_lit.record_expr_field_list()?; for record_field in record_field_list.fields() { if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { let field_name = name_ref.syntax().text().to_string(); -- cgit v1.2.3 From 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:49:13 +0200 Subject: Rename FieldDef -> Field --- crates/ra_ide/src/diagnostics.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_ide/src/diagnostics.rs') diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index efbb00d6d..dd8a7ffd9 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -155,21 +155,21 @@ fn missing_struct_field_fix( module = s.module(sema.db); let source = s.source(sema.db); def_file_id = source.file_id; - let fields = source.value.field_def_list()?; - record_field_def_list(fields)? + let fields = source.value.field_list()?; + record_field_list(fields)? } VariantDef::Union(u) => { module = u.module(sema.db); let source = u.source(sema.db); def_file_id = source.file_id; - source.value.record_field_def_list()? + source.value.record_field_list()? } VariantDef::EnumVariant(e) => { module = e.module(sema.db); let source = e.source(sema.db); def_file_id = source.file_id; - let fields = source.value.field_def_list()?; - record_field_def_list(fields)? + let fields = source.value.field_list()?; + record_field_list(fields)? } }; let def_file_id = def_file_id.original_file(sema.db); @@ -205,10 +205,10 @@ fn missing_struct_field_fix( let fix = Fix::new("Create field", source_change.into()); return Some(fix); - fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option { + fn record_field_list(field_def_list: ast::FieldList) -> Option { match field_def_list { - ast::FieldDefList::RecordFieldDefList(it) => Some(it), - ast::FieldDefList::TupleFieldDefList(_) => None, + ast::FieldList::RecordFieldList(it) => Some(it), + ast::FieldList::TupleFieldList(_) => None, } } } -- cgit v1.2.3 From 09d3b7d7a2ae23a0463fadee9ae8cb6a0fa2c4bf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 5 Aug 2020 19:29:24 +0200 Subject: align names in make --- crates/ra_ide/src/diagnostics.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide/src/diagnostics.rs') diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index dd8a7ffd9..73c0b8275 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -78,8 +78,10 @@ pub(crate) fn diagnostics( } else { let mut field_list = d.ast(db); for f in d.missed_fields.iter() { - let field = - make::record_field(make::name_ref(&f.to_string()), Some(make::expr_unit())); + let field = make::record_expr_field( + make::name_ref(&f.to_string()), + Some(make::expr_unit()), + ); field_list = field_list.append_field(&field); } @@ -178,9 +180,9 @@ fn missing_struct_field_fix( if new_field_type.is_unknown() { return None; } - let new_field = make::record_field_def( + let new_field = make::record_field( record_expr.field_name()?, - make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?), + make::ty(&new_field_type.display_source_code(sema.db, module.into()).ok()?), ); let last_field = record_fields.fields().last()?; -- cgit v1.2.3