aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-25 13:25:28 +0100
committerGitHub <[email protected]>2020-04-25 13:25:28 +0100
commit05981823bac91ba338110902fd435c6e3166f1d6 (patch)
tree24b14acc3cfb37489c413c0dfba16dbc8b630869 /crates/ra_ide
parent7bc71732300a57fad928393220ecbe5f751cc20f (diff)
parent970dbf871795650ecf49b7198d53bdcad9c612af (diff)
Merge #4135
4135: Rename StructField -> Field r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs7
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs4
-rw-r--r--crates/ra_ide/src/hover.rs4
-rw-r--r--crates/ra_ide/src/references.rs2
-rw-r--r--crates/ra_ide/src/references/rename.rs4
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs2
6 files changed, 9 insertions, 14 deletions
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::{
15}; 15};
16 16
17impl Completions { 17impl Completions {
18 pub(crate) fn add_field( 18 pub(crate) fn add_field(&mut self, ctx: &CompletionContext, field: hir::Field, ty: &Type) {
19 &mut self,
20 ctx: &CompletionContext,
21 field: hir::StructField,
22 ty: &Type,
23 ) {
24 let is_deprecated = is_deprecated(field, ctx.db); 19 let is_deprecated = is_deprecated(field, ctx.db);
25 let ty = ty.display(ctx.db).to_string(); 20 let ty = ty.display(ctx.db).to_string();
26 let name = field.name(ctx.db); 21 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 {
189 fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { 189 fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> {
190 match self { 190 match self {
191 Definition::Macro(it) => Some(it.to_nav(db)), 191 Definition::Macro(it) => Some(it.to_nav(db)),
192 Definition::StructField(it) => Some(it.to_nav(db)), 192 Definition::Field(it) => Some(it.to_nav(db)),
193 Definition::ModuleDef(it) => it.try_to_nav(db), 193 Definition::ModuleDef(it) => it.try_to_nav(db),
194 Definition::SelfType(it) => Some(it.to_nav(db)), 194 Definition::SelfType(it) => Some(it.to_nav(db)),
195 Definition::Local(it) => Some(it.to_nav(db)), 195 Definition::Local(it) => Some(it.to_nav(db)),
@@ -286,7 +286,7 @@ impl ToNav for hir::ImplDef {
286 } 286 }
287} 287}
288 288
289impl ToNav for hir::StructField { 289impl ToNav for hir::Field {
290 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 290 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
291 let src = self.source(db); 291 let src = self.source(db);
292 292
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(
76 76
77fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String> { 77fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String> {
78 match def { 78 match def {
79 Definition::StructField(f) => Some(f.parent_def(db).name(db)), 79 Definition::Field(f) => Some(f.parent_def(db).name(db)),
80 Definition::Local(l) => l.parent(db).name(db), 80 Definition::Local(l) => l.parent(db).name(db),
81 Definition::ModuleDef(md) => match md { 81 Definition::ModuleDef(md) => match md {
82 ModuleDef::Function(f) => match f.as_assoc_item(db)?.container(db) { 82 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<Strin
116 let src = it.source(db); 116 let src = it.source(db);
117 hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value)), mod_path) 117 hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value)), mod_path)
118 } 118 }
119 Definition::StructField(it) => { 119 Definition::Field(it) => {
120 let src = it.source(db); 120 let src = it.source(db);
121 match src.value { 121 match src.value {
122 FieldSource::Named(it) => { 122 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(
144 144
145fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Option<ReferenceAccess> { 145fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Option<ReferenceAccess> {
146 match def { 146 match def {
147 Definition::Local(_) | Definition::StructField(_) => {} 147 Definition::Local(_) | Definition::Field(_) => {}
148 _ => return None, 148 _ => return None,
149 }; 149 };
150 150
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
51 let mut replacement_text = String::new(); 51 let mut replacement_text = String::new();
52 let file_id = reference.file_range.file_id; 52 let file_id = reference.file_range.file_id;
53 let range = match reference.kind { 53 let range = match reference.kind {
54 ReferenceKind::StructFieldShorthandForField => { 54 ReferenceKind::FieldShorthandForField => {
55 replacement_text.push_str(new_name); 55 replacement_text.push_str(new_name);
56 replacement_text.push_str(": "); 56 replacement_text.push_str(": ");
57 TextRange::new(reference.file_range.range.start(), reference.file_range.range.start()) 57 TextRange::new(reference.file_range.range.start(), reference.file_range.range.start())
58 } 58 }
59 ReferenceKind::StructFieldShorthandForLocal => { 59 ReferenceKind::FieldShorthandForLocal => {
60 replacement_text.push_str(": "); 60 replacement_text.push_str(": ");
61 replacement_text.push_str(new_name); 61 replacement_text.push_str(new_name);
62 TextRange::new(reference.file_range.range.end(), reference.file_range.range.end()) 62 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(
422fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { 422fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight {
423 match def { 423 match def {
424 Definition::Macro(_) => HighlightTag::Macro, 424 Definition::Macro(_) => HighlightTag::Macro,
425 Definition::StructField(_) => HighlightTag::Field, 425 Definition::Field(_) => HighlightTag::Field,
426 Definition::ModuleDef(def) => match def { 426 Definition::ModuleDef(def) => match def {
427 hir::ModuleDef::Module(_) => HighlightTag::Module, 427 hir::ModuleDef::Module(_) => HighlightTag::Module,
428 hir::ModuleDef::Function(_) => HighlightTag::Function, 428 hir::ModuleDef::Function(_) => HighlightTag::Function,