diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-20 16:09:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-20 16:09:51 +0100 |
commit | 1c24f57ef8420e924e904ec481e7c6471f3ddcc8 (patch) | |
tree | c7f1ebcc5979838d1747cf19dd562004916a7274 /crates/hir_def/src | |
parent | be762ccccd5a86632e60351518528d078785a3e2 (diff) | |
parent | 3b1a648539487c08bc613b6fd6e573b0e0e38948 (diff) |
Merge #6295
6295: More type safety around names r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/import_map.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/nameres.rs | 6 |
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 { | |||
172 | impl CrateDefMap { | 172 | impl 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; |