aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/references/name_definition.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/references/name_definition.rs')
-rw-r--r--crates/ra_ide_api/src/references/name_definition.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/references/name_definition.rs b/crates/ra_ide_api/src/references/name_definition.rs
index ccd75278a..aca23f79e 100644
--- a/crates/ra_ide_api/src/references/name_definition.rs
+++ b/crates/ra_ide_api/src/references/name_definition.rs
@@ -32,9 +32,9 @@ pub(crate) struct NameDefinition {
32pub(super) fn from_assoc_item(db: &RootDatabase, item: AssocItem) -> NameDefinition { 32pub(super) fn from_assoc_item(db: &RootDatabase, item: AssocItem) -> NameDefinition {
33 let container = item.module(db); 33 let container = item.module(db);
34 let visibility = match item { 34 let visibility = match item {
35 AssocItem::Function(f) => f.source(db).ast.visibility(), 35 AssocItem::Function(f) => f.source(db).value.visibility(),
36 AssocItem::Const(c) => c.source(db).ast.visibility(), 36 AssocItem::Const(c) => c.source(db).value.visibility(),
37 AssocItem::TypeAlias(a) => a.source(db).ast.visibility(), 37 AssocItem::TypeAlias(a) => a.source(db).value.visibility(),
38 }; 38 };
39 let kind = NameKind::AssocItem(item); 39 let kind = NameKind::AssocItem(item);
40 NameDefinition { kind, container, visibility } 40 NameDefinition { kind, container, visibility }
@@ -45,8 +45,8 @@ pub(super) fn from_struct_field(db: &RootDatabase, field: StructField) -> NameDe
45 let parent = field.parent_def(db); 45 let parent = field.parent_def(db);
46 let container = parent.module(db); 46 let container = parent.module(db);
47 let visibility = match parent { 47 let visibility = match parent {
48 VariantDef::Struct(s) => s.source(db).ast.visibility(), 48 VariantDef::Struct(s) => s.source(db).value.visibility(),
49 VariantDef::EnumVariant(e) => e.source(db).ast.parent_enum().visibility(), 49 VariantDef::EnumVariant(e) => e.source(db).value.parent_enum().visibility(),
50 }; 50 };
51 NameDefinition { kind, container, visibility } 51 NameDefinition { kind, container, visibility }
52} 52}
@@ -60,22 +60,22 @@ pub(super) fn from_module_def(
60 let (container, visibility) = match def { 60 let (container, visibility) = match def {
61 ModuleDef::Module(it) => { 61 ModuleDef::Module(it) => {
62 let container = it.parent(db).or_else(|| Some(it)).unwrap(); 62 let container = it.parent(db).or_else(|| Some(it)).unwrap();
63 let visibility = it.declaration_source(db).and_then(|s| s.ast.visibility()); 63 let visibility = it.declaration_source(db).and_then(|s| s.value.visibility());
64 (container, visibility) 64 (container, visibility)
65 } 65 }
66 ModuleDef::EnumVariant(it) => { 66 ModuleDef::EnumVariant(it) => {
67 let container = it.module(db); 67 let container = it.module(db);
68 let visibility = it.source(db).ast.parent_enum().visibility(); 68 let visibility = it.source(db).value.parent_enum().visibility();
69 (container, visibility) 69 (container, visibility)
70 } 70 }
71 ModuleDef::Function(it) => (it.module(db), it.source(db).ast.visibility()), 71 ModuleDef::Function(it) => (it.module(db), it.source(db).value.visibility()),
72 ModuleDef::Const(it) => (it.module(db), it.source(db).ast.visibility()), 72 ModuleDef::Const(it) => (it.module(db), it.source(db).value.visibility()),
73 ModuleDef::Static(it) => (it.module(db), it.source(db).ast.visibility()), 73 ModuleDef::Static(it) => (it.module(db), it.source(db).value.visibility()),
74 ModuleDef::Trait(it) => (it.module(db), it.source(db).ast.visibility()), 74 ModuleDef::Trait(it) => (it.module(db), it.source(db).value.visibility()),
75 ModuleDef::TypeAlias(it) => (it.module(db), it.source(db).ast.visibility()), 75 ModuleDef::TypeAlias(it) => (it.module(db), it.source(db).value.visibility()),
76 ModuleDef::Adt(Adt::Struct(it)) => (it.module(db), it.source(db).ast.visibility()), 76 ModuleDef::Adt(Adt::Struct(it)) => (it.module(db), it.source(db).value.visibility()),
77 ModuleDef::Adt(Adt::Union(it)) => (it.module(db), it.source(db).ast.visibility()), 77 ModuleDef::Adt(Adt::Union(it)) => (it.module(db), it.source(db).value.visibility()),
78 ModuleDef::Adt(Adt::Enum(it)) => (it.module(db), it.source(db).ast.visibility()), 78 ModuleDef::Adt(Adt::Enum(it)) => (it.module(db), it.source(db).value.visibility()),
79 ModuleDef::BuiltinType(..) => (module.unwrap(), None), 79 ModuleDef::BuiltinType(..) => (module.unwrap(), None),
80 }; 80 };
81 NameDefinition { kind, container, visibility } 81 NameDefinition { kind, container, visibility }