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).
This commit is contained in:
Aleksey Kladov 2020-10-20 15:38:11 +02:00
parent be762ccccd
commit af4e75533f
11 changed files with 28 additions and 35 deletions

View file

@ -356,7 +356,7 @@ mod tests {
let krate = crate_graph
.iter()
.find(|krate| {
crate_graph[*krate].declaration_name.as_ref().map(|n| n.to_string())
crate_graph[*krate].display_name.as_ref().map(|n| n.to_string())
== Some(crate_name.to_string())
})
.unwrap();
@ -375,7 +375,7 @@ mod tests {
let path = map.path_of(item).unwrap();
format!(
"{}::{} ({})\n",
crate_graph[krate].declaration_name.as_ref().unwrap(),
crate_graph[krate].display_name.as_ref().unwrap(),
path,
mark
)
@ -416,7 +416,7 @@ mod tests {
.iter()
.filter_map(|krate| {
let cdata = &crate_graph[krate];
let name = cdata.declaration_name.as_ref()?;
let name = cdata.display_name.as_ref()?;
let map = db.import_map(krate);

View file

@ -172,11 +172,7 @@ pub struct ModuleData {
impl CrateDefMap {
pub(crate) fn crate_def_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
let _p = profile::span("crate_def_map_query").detail(|| {
db.crate_graph()[krate]
.declaration_name
.as_ref()
.map(ToString::to_string)
.unwrap_or_default()
db.crate_graph()[krate].display_name.as_deref().unwrap_or_default().to_string()
});
let def_map = {
let edition = db.crate_graph()[krate].edition;