aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-10-20 14:38:11 +0100
committerAleksey Kladov <[email protected]>2020-10-20 14:38:11 +0100
commitaf4e75533f2c071330e740e2fa94b131e3a2b538 (patch)
tree6f517a43814751d8b1ea478b5ed03baf57b4f0b5 /crates/hir_def/src
parentbe762ccccd5a86632e60351518528d078785a3e2 (diff)
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).
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/import_map.rs6
-rw-r--r--crates/hir_def/src/nameres.rs6
2 files changed, 4 insertions, 8 deletions
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs
index 028cae2e7..1e24f29a8 100644
--- a/crates/hir_def/src/import_map.rs
+++ b/crates/hir_def/src/import_map.rs
@@ -356,7 +356,7 @@ mod tests {
356 let krate = crate_graph 356 let krate = crate_graph
357 .iter() 357 .iter()
358 .find(|krate| { 358 .find(|krate| {
359 crate_graph[*krate].declaration_name.as_ref().map(|n| n.to_string()) 359 crate_graph[*krate].display_name.as_ref().map(|n| n.to_string())
360 == Some(crate_name.to_string()) 360 == Some(crate_name.to_string())
361 }) 361 })
362 .unwrap(); 362 .unwrap();
@@ -375,7 +375,7 @@ mod tests {
375 let path = map.path_of(item).unwrap(); 375 let path = map.path_of(item).unwrap();
376 format!( 376 format!(
377 "{}::{} ({})\n", 377 "{}::{} ({})\n",
378 crate_graph[krate].declaration_name.as_ref().unwrap(), 378 crate_graph[krate].display_name.as_ref().unwrap(),
379 path, 379 path,
380 mark 380 mark
381 ) 381 )
@@ -416,7 +416,7 @@ mod tests {
416 .iter() 416 .iter()
417 .filter_map(|krate| { 417 .filter_map(|krate| {
418 let cdata = &crate_graph[krate]; 418 let cdata = &crate_graph[krate];
419 let name = cdata.declaration_name.as_ref()?; 419 let name = cdata.display_name.as_ref()?;
420 420
421 let map = db.import_map(krate); 421 let map = db.import_map(krate);
422 422
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 464ffef21..3d04f81c6 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -172,11 +172,7 @@ pub struct ModuleData {
172impl CrateDefMap { 172impl CrateDefMap {
173 pub(crate) fn crate_def_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { 173 pub(crate) fn crate_def_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
174 let _p = profile::span("crate_def_map_query").detail(|| { 174 let _p = profile::span("crate_def_map_query").detail(|| {
175 db.crate_graph()[krate] 175 db.crate_graph()[krate].display_name.as_deref().unwrap_or_default().to_string()
176 .declaration_name
177 .as_ref()
178 .map(ToString::to_string)
179 .unwrap_or_default()
180 }); 176 });
181 let def_map = { 177 let def_map = {
182 let edition = db.crate_graph()[krate].edition; 178 let edition = db.crate_graph()[krate].edition;