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/ide/src/inlay_hints.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ide/src/inlay_hints.rs') diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index e2079bbcf..f5f366354 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -215,7 +215,7 @@ fn hint_iterator( .last() .and_then(|strukt| strukt.as_adt())?; let krate = strukt.krate(db)?; - if krate.declaration_name(db).as_deref() != Some("core") { + if krate.display_name(db).as_deref() != Some("core") { return None; } let iter_trait = FamousDefs(sema, krate).core_iter_Iterator()?; -- 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/ide/src/inlay_hints.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/ide/src/inlay_hints.rs') diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index f5f366354..56b985e80 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -1,15 +1,14 @@ use assists::utils::FamousDefs; +use either::Either; use hir::{known, HirDisplay, Semantics}; use ide_db::RootDatabase; use stdx::to_lower_snake_case; use syntax::{ - ast::{self, ArgListOwner, AstNode}, + ast::{self, ArgListOwner, AstNode, NameOwner}, match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, }; use crate::FileId; -use ast::NameOwner; -use either::Either; #[derive(Clone, Debug, PartialEq, Eq)] pub struct InlayHintsConfig { -- cgit v1.2.3