aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-10-15 15:15:01 +0100
committerAleksey Kladov <[email protected]>2020-10-15 16:37:36 +0100
commitfa3c449d8f5a67865cab8d4717b3e32dca5b672a (patch)
tree8143b3ee53bbd2b36768fbe085b4ddc6b7b70514 /crates/ide_db
parent7fadc78ebb43b0eb9b6ccf314e29bdd23717542f (diff)
Clarify NameClass names a bit
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/defs.rs4
-rw-r--r--crates/ide_db/src/imports_locator.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
index f8c7aa491..a243dcd15 100644
--- a/crates/ide_db/src/defs.rs
+++ b/crates/ide_db/src/defs.rs
@@ -90,7 +90,7 @@ pub enum NameClass {
90} 90}
91 91
92impl NameClass { 92impl NameClass {
93 pub fn into_definition(self, db: &dyn HirDatabase) -> Option<Definition> { 93 pub fn definition(self, db: &dyn HirDatabase) -> Option<Definition> {
94 Some(match self { 94 Some(match self {
95 NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()), 95 NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()),
96 NameClass::Definition(it) => it, 96 NameClass::Definition(it) => it,
@@ -99,7 +99,7 @@ impl NameClass {
99 }) 99 })
100 } 100 }
101 101
102 pub fn definition(self, db: &dyn HirDatabase) -> Definition { 102 pub fn definition_or_reference(self, db: &dyn HirDatabase) -> Definition {
103 match self { 103 match self {
104 NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()), 104 NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()),
105 NameClass::Definition(it) | NameClass::ConstReference(it) => it, 105 NameClass::Definition(it) | NameClass::ConstReference(it) => it,
diff --git a/crates/ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs
index ed67e3553..e0d3e7293 100644
--- a/crates/ide_db/src/imports_locator.rs
+++ b/crates/ide_db/src/imports_locator.rs
@@ -60,5 +60,5 @@ fn get_name_definition<'a>(
60 candidate_node 60 candidate_node
61 }; 61 };
62 let name = ast::Name::cast(candidate_name_node)?; 62 let name = ast::Name::cast(candidate_name_node)?;
63 classify_name(sema, &name)?.into_definition(sema.db) 63 classify_name(sema, &name)?.definition(sema.db)
64} 64}