aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-07 13:26:59 +0000
committerAleksey Kladov <[email protected]>2020-02-07 13:26:59 +0000
commitae70d072374f3c4d14abdccbe61661cf02b41b33 (patch)
tree7b4540f55d2cae95e2682920a6946736a22c351f /crates
parentf55be75a17dab2ca23b34c45e7597fe19a5fc8e4 (diff)
Rename
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/goto_definition.rs4
-rw-r--r--crates/ra_ide/src/hover.rs4
-rw-r--r--crates/ra_ide/src/references.rs8
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs20
-rw-r--r--crates/ra_ide_db/src/defs.rs8
-rw-r--r--crates/ra_ide_db/src/imports_locator.rs2
6 files changed, 23 insertions, 23 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 080cc302b..de5551a4c 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -76,10 +76,10 @@ pub(crate) fn reference_definition(
76 let name_kind = classify_name_ref(sb, name_ref).map(|d| d.kind); 76 let name_kind = classify_name_ref(sb, name_ref).map(|d| d.kind);
77 match name_kind { 77 match name_kind {
78 Some(Macro(it)) => return Exact(it.to_nav(sb.db)), 78 Some(Macro(it)) => return Exact(it.to_nav(sb.db)),
79 Some(Field(it)) => return Exact(it.to_nav(sb.db)), 79 Some(StructField(it)) => return Exact(it.to_nav(sb.db)),
80 Some(TypeParam(it)) => return Exact(it.to_nav(sb.db)), 80 Some(TypeParam(it)) => return Exact(it.to_nav(sb.db)),
81 Some(Local(it)) => return Exact(it.to_nav(sb.db)), 81 Some(Local(it)) => return Exact(it.to_nav(sb.db)),
82 Some(Def(def)) => match NavigationTarget::from_def(sb.db, def) { 82 Some(ModuleDef(def)) => match NavigationTarget::from_def(sb.db, def) {
83 Some(nav) => return Exact(nav), 83 Some(nav) => return Exact(nav),
84 None => return Approximate(vec![]), 84 None => return Approximate(vec![]),
85 }, 85 },
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index ab3f513f2..3f88bb260 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -98,14 +98,14 @@ fn hover_text_from_name_kind(db: &RootDatabase, name_kind: NameKind) -> Option<S
98 let src = it.source(db); 98 let src = it.source(db);
99 hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value))) 99 hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value)))
100 } 100 }
101 Field(it) => { 101 StructField(it) => {
102 let src = it.source(db); 102 let src = it.source(db);
103 match src.value { 103 match src.value {
104 hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()), 104 hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()),
105 _ => None, 105 _ => None,
106 } 106 }
107 } 107 }
108 Def(it) => match it { 108 ModuleDef(it) => match it {
109 hir::ModuleDef::Module(it) => match it.definition_source(db).value { 109 hir::ModuleDef::Module(it) => match it.definition_source(db).value {
110 hir::ModuleSource::Module(it) => { 110 hir::ModuleSource::Module(it) => {
111 hover_text(it.doc_comment_text(), it.short_label()) 111 hover_text(it.doc_comment_text(), it.short_label())
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 612ed84b7..a6320bd2f 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -127,8 +127,8 @@ pub(crate) fn find_all_refs(
127 127
128 let declaration = match def.kind { 128 let declaration = match def.kind {
129 NameKind::Macro(mac) => mac.to_nav(db), 129 NameKind::Macro(mac) => mac.to_nav(db),
130 NameKind::Field(field) => field.to_nav(db), 130 NameKind::StructField(field) => field.to_nav(db),
131 NameKind::Def(def) => NavigationTarget::from_def(db, def)?, 131 NameKind::ModuleDef(def) => NavigationTarget::from_def(db, def)?,
132 NameKind::SelfType(imp) => imp.to_nav(db), 132 NameKind::SelfType(imp) => imp.to_nav(db),
133 NameKind::Local(local) => local.to_nav(db), 133 NameKind::Local(local) => local.to_nav(db),
134 NameKind::TypeParam(_) => return None, 134 NameKind::TypeParam(_) => return None,
@@ -239,7 +239,7 @@ fn decl_access(
239 range: TextRange, 239 range: TextRange,
240) -> Option<ReferenceAccess> { 240) -> Option<ReferenceAccess> {
241 match kind { 241 match kind {
242 NameKind::Local(_) | NameKind::Field(_) => {} 242 NameKind::Local(_) | NameKind::StructField(_) => {}
243 _ => return None, 243 _ => return None,
244 }; 244 };
245 245
@@ -259,7 +259,7 @@ fn decl_access(
259fn reference_access(kind: &NameKind, name_ref: &ast::NameRef) -> Option<ReferenceAccess> { 259fn reference_access(kind: &NameKind, name_ref: &ast::NameRef) -> Option<ReferenceAccess> {
260 // Only Locals and Fields have accesses for now. 260 // Only Locals and Fields have accesses for now.
261 match kind { 261 match kind {
262 NameKind::Local(_) | NameKind::Field(_) => {} 262 NameKind::Local(_) | NameKind::StructField(_) => {}
263 _ => return None, 263 _ => return None,
264 }; 264 };
265 265
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index c970f5d34..174e13595 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -320,16 +320,16 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo
320fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str { 320fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str {
321 match name_kind { 321 match name_kind {
322 Macro(_) => tags::MACRO, 322 Macro(_) => tags::MACRO,
323 Field(_) => tags::FIELD, 323 StructField(_) => tags::FIELD,
324 Def(hir::ModuleDef::Module(_)) => tags::MODULE, 324 ModuleDef(hir::ModuleDef::Module(_)) => tags::MODULE,
325 Def(hir::ModuleDef::Function(_)) => tags::FUNCTION, 325 ModuleDef(hir::ModuleDef::Function(_)) => tags::FUNCTION,
326 Def(hir::ModuleDef::Adt(_)) => tags::TYPE, 326 ModuleDef(hir::ModuleDef::Adt(_)) => tags::TYPE,
327 Def(hir::ModuleDef::EnumVariant(_)) => tags::CONSTANT, 327 ModuleDef(hir::ModuleDef::EnumVariant(_)) => tags::CONSTANT,
328 Def(hir::ModuleDef::Const(_)) => tags::CONSTANT, 328 ModuleDef(hir::ModuleDef::Const(_)) => tags::CONSTANT,
329 Def(hir::ModuleDef::Static(_)) => tags::CONSTANT, 329 ModuleDef(hir::ModuleDef::Static(_)) => tags::CONSTANT,
330 Def(hir::ModuleDef::Trait(_)) => tags::TYPE, 330 ModuleDef(hir::ModuleDef::Trait(_)) => tags::TYPE,
331 Def(hir::ModuleDef::TypeAlias(_)) => tags::TYPE, 331 ModuleDef(hir::ModuleDef::TypeAlias(_)) => tags::TYPE,
332 Def(hir::ModuleDef::BuiltinType(_)) => tags::TYPE_BUILTIN, 332 ModuleDef(hir::ModuleDef::BuiltinType(_)) => tags::TYPE_BUILTIN,
333 SelfType(_) => tags::TYPE_SELF, 333 SelfType(_) => tags::TYPE_SELF,
334 TypeParam(_) => tags::TYPE_PARAM, 334 TypeParam(_) => tags::TYPE_PARAM,
335 Local(local) => { 335 Local(local) => {
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 0599f5e38..030f44f86 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -20,8 +20,8 @@ use crate::RootDatabase;
20#[derive(Debug, PartialEq, Eq)] 20#[derive(Debug, PartialEq, Eq)]
21pub enum NameKind { 21pub enum NameKind {
22 Macro(MacroDef), 22 Macro(MacroDef),
23 Field(StructField), 23 StructField(StructField),
24 Def(ModuleDef), 24 ModuleDef(ModuleDef),
25 SelfType(ImplBlock), 25 SelfType(ImplBlock),
26 Local(Local), 26 Local(Local),
27 TypeParam(TypeParam), 27 TypeParam(TypeParam),
@@ -130,7 +130,7 @@ pub fn classify_name(
130} 130}
131 131
132pub fn from_struct_field(db: &RootDatabase, field: StructField) -> NameDefinition { 132pub fn from_struct_field(db: &RootDatabase, field: StructField) -> NameDefinition {
133 let kind = NameKind::Field(field); 133 let kind = NameKind::StructField(field);
134 let parent = field.parent_def(db); 134 let parent = field.parent_def(db);
135 let container = parent.module(db); 135 let container = parent.module(db);
136 let visibility = match parent { 136 let visibility = match parent {
@@ -146,7 +146,7 @@ pub fn from_module_def(
146 def: ModuleDef, 146 def: ModuleDef,
147 module: Option<Module>, 147 module: Option<Module>,
148) -> NameDefinition { 148) -> NameDefinition {
149 let kind = NameKind::Def(def); 149 let kind = NameKind::ModuleDef(def);
150 let (container, visibility) = match def { 150 let (container, visibility) = match def {
151 ModuleDef::Module(it) => { 151 ModuleDef::Module(it) => {
152 let container = it.parent(db).or_else(|| Some(it)).unwrap(); 152 let container = it.parent(db).or_else(|| Some(it)).unwrap();
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ra_ide_db/src/imports_locator.rs
index 401b8ac0b..86383bcd0 100644
--- a/crates/ra_ide_db/src/imports_locator.rs
+++ b/crates/ra_ide_db/src/imports_locator.rs
@@ -44,7 +44,7 @@ impl<'a> ImportsLocator<'a> {
44 .chain(lib_results.into_iter()) 44 .chain(lib_results.into_iter())
45 .filter_map(|import_candidate| self.get_name_definition(db, &import_candidate)) 45 .filter_map(|import_candidate| self.get_name_definition(db, &import_candidate))
46 .filter_map(|name_definition_to_import| match name_definition_to_import { 46 .filter_map(|name_definition_to_import| match name_definition_to_import {
47 NameKind::Def(module_def) => Some(module_def), 47 NameKind::ModuleDef(module_def) => Some(module_def),
48 _ => None, 48 _ => None,
49 }) 49 })
50 .collect() 50 .collect()