From af4e75533f2c071330e740e2fa94b131e3a2b538 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Oct 2020 15:38:11 +0200 Subject: Rename declaration_name -> display_name Declaration names sounds like a name of declaration -- something you can use for analysis. It empathically isn't, and is just a label displayed in various UI. It's important not to confuse the two, least we accidentally mix semantics with UI (I believe, there's already a case of this in the FamousDefs at least). --- crates/hir/src/code_model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir/src/code_model.rs') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index b65be4fe1..64f3fbe31 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -103,8 +103,8 @@ impl Crate { db.crate_graph()[self.id].edition } - pub fn declaration_name(self, db: &dyn HirDatabase) -> Option { - db.crate_graph()[self.id].declaration_name.clone() + pub fn display_name(self, db: &dyn HirDatabase) -> Option { + db.crate_graph()[self.id].display_name.clone() } pub fn query_external_importables( -- cgit v1.2.3 From 3b1a648539487c08bc613b6fd6e573b0e0e38948 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Oct 2020 17:04:38 +0200 Subject: More type safety around names --- crates/hir/src/code_model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir/src/code_model.rs') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 64f3fbe31..7f169ccd2 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -2,7 +2,7 @@ use std::{iter, sync::Arc}; use arrayvec::ArrayVec; -use base_db::{CrateId, CrateName, Edition, FileId}; +use base_db::{CrateDisplayName, CrateId, Edition, FileId}; use either::Either; use hir_def::find_path::PrefixKind; use hir_def::{ @@ -103,7 +103,7 @@ impl Crate { db.crate_graph()[self.id].edition } - pub fn display_name(self, db: &dyn HirDatabase) -> Option { + pub fn display_name(self, db: &dyn HirDatabase) -> Option { db.crate_graph()[self.id].display_name.clone() } -- cgit v1.2.3