From fa3c449d8f5a67865cab8d4717b3e32dca5b672a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 15 Oct 2020 16:15:01 +0200 Subject: Clarify NameClass names a bit --- crates/ide_db/src/defs.rs | 4 ++-- crates/ide_db/src/imports_locator.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide_db') 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 { } impl NameClass { - pub fn into_definition(self, db: &dyn HirDatabase) -> Option { + pub fn definition(self, db: &dyn HirDatabase) -> Option { Some(match self { NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()), NameClass::Definition(it) => it, @@ -99,7 +99,7 @@ impl NameClass { }) } - pub fn definition(self, db: &dyn HirDatabase) -> Definition { + pub fn definition_or_reference(self, db: &dyn HirDatabase) -> Definition { match self { NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db).into()), 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>( candidate_node }; let name = ast::Name::cast(candidate_name_node)?; - classify_name(sema, &name)?.into_definition(sema.db) + classify_name(sema, &name)?.definition(sema.db) } -- cgit v1.2.3