From 970dbf871795650ecf49b7198d53bdcad9c612af Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Apr 2020 14:23:34 +0200 Subject: Rename StructField -> Field --- crates/ra_ide/src/completion/presentation.rs | 7 +------ crates/ra_ide/src/display/navigation_target.rs | 4 ++-- crates/ra_ide/src/hover.rs | 4 ++-- crates/ra_ide/src/references.rs | 2 +- crates/ra_ide/src/references/rename.rs | 4 ++-- crates/ra_ide/src/syntax_highlighting.rs | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 9f9f06bf0..7633cd7fd 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs @@ -15,12 +15,7 @@ use crate::{ }; impl Completions { - pub(crate) fn add_field( - &mut self, - ctx: &CompletionContext, - field: hir::StructField, - ty: &Type, - ) { + pub(crate) fn add_field(&mut self, ctx: &CompletionContext, field: hir::Field, ty: &Type) { let is_deprecated = is_deprecated(field, ctx.db); let ty = ty.display(ctx.db).to_string(); let name = field.name(ctx.db); diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 67bc9c31b..914a8b471 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -189,7 +189,7 @@ impl TryToNav for Definition { fn try_to_nav(&self, db: &RootDatabase) -> Option { match self { Definition::Macro(it) => Some(it.to_nav(db)), - Definition::StructField(it) => Some(it.to_nav(db)), + Definition::Field(it) => Some(it.to_nav(db)), Definition::ModuleDef(it) => it.try_to_nav(db), Definition::SelfType(it) => Some(it.to_nav(db)), Definition::Local(it) => Some(it.to_nav(db)), @@ -286,7 +286,7 @@ impl ToNav for hir::ImplDef { } } -impl ToNav for hir::StructField { +impl ToNav for hir::Field { fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { let src = self.source(db); diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index fcc2ab7fb..58c799eca 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -76,7 +76,7 @@ fn hover_text( fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option { match def { - Definition::StructField(f) => Some(f.parent_def(db).name(db)), + Definition::Field(f) => Some(f.parent_def(db).name(db)), Definition::Local(l) => l.parent(db).name(db), Definition::ModuleDef(md) => match md { ModuleDef::Function(f) => match f.as_assoc_item(db)?.container(db) { @@ -116,7 +116,7 @@ fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option { + Definition::Field(it) => { let src = it.source(db); match src.value { FieldSource::Named(it) => { diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index a3970bf83..555ccf295 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -144,7 +144,7 @@ fn find_name( fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Option { match def { - Definition::Local(_) | Definition::StructField(_) => {} + Definition::Local(_) | Definition::Field(_) => {} _ => return None, }; diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index a8f320e2f..fd17bc9f2 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -51,12 +51,12 @@ fn source_edit_from_reference(reference: Reference, new_name: &str) -> SourceFil let mut replacement_text = String::new(); let file_id = reference.file_range.file_id; let range = match reference.kind { - ReferenceKind::StructFieldShorthandForField => { + ReferenceKind::FieldShorthandForField => { replacement_text.push_str(new_name); replacement_text.push_str(": "); TextRange::new(reference.file_range.range.start(), reference.file_range.range.start()) } - ReferenceKind::StructFieldShorthandForLocal => { + ReferenceKind::FieldShorthandForLocal => { replacement_text.push_str(": "); replacement_text.push_str(new_name); TextRange::new(reference.file_range.range.end(), reference.file_range.range.end()) diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 6f02614a6..be0f8c827 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -422,7 +422,7 @@ fn highlight_element( fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { match def { Definition::Macro(_) => HighlightTag::Macro, - Definition::StructField(_) => HighlightTag::Field, + Definition::Field(_) => HighlightTag::Field, Definition::ModuleDef(def) => match def { hir::ModuleDef::Module(_) => HighlightTag::Module, hir::ModuleDef::Function(_) => HighlightTag::Function, -- cgit v1.2.3