aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-06 12:51:15 +0100
committerGitHub <[email protected]>2020-10-06 12:51:15 +0100
commit87cb840a4e140a49946235823384694da58c2a5a (patch)
tree4e6ce0749103bdf8e373b3d12472866bdc10d4c8 /crates/hir_def
parentaf0e54a566ab8c8be9b39a628aaa4992f161695c (diff)
parent9d19e5b962f77259dd1334b9edb4da4de54f0987 (diff)
Merge #6124
6124: Better normalized crate name usage r=jonas-schievink a=SomeoneToIgnore Closes https://github.com/rust-analyzer/rust-analyzer/issues/5343 Closes https://github.com/rust-analyzer/rust-analyzer/issues/5932 Uses normalized name for code snippets (to be able to test the fix), hover messages and documentation rewrite links (are there any tests for those?). Also renamed the field to better resemble the semantics. Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/import_map.rs10
-rw-r--r--crates/hir_def/src/nameres.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs
index a442fb63a..44bfe1593 100644
--- a/crates/hir_def/src/import_map.rs
+++ b/crates/hir_def/src/import_map.rs
@@ -334,14 +334,14 @@ mod tests {
334 334
335 use super::*; 335 use super::*;
336 336
337 fn check_search(ra_fixture: &str, krate_name: &str, query: Query, expect: Expect) { 337 fn check_search(ra_fixture: &str, crate_name: &str, query: Query, expect: Expect) {
338 let db = TestDB::with_files(ra_fixture); 338 let db = TestDB::with_files(ra_fixture);
339 let crate_graph = db.crate_graph(); 339 let crate_graph = db.crate_graph();
340 let krate = crate_graph 340 let krate = crate_graph
341 .iter() 341 .iter()
342 .find(|krate| { 342 .find(|krate| {
343 crate_graph[*krate].display_name.as_ref().map(|n| n.to_string()) 343 crate_graph[*krate].declaration_name.as_ref().map(|n| n.to_string())
344 == Some(krate_name.to_string()) 344 == Some(crate_name.to_string())
345 }) 345 })
346 .unwrap(); 346 .unwrap();
347 347
@@ -359,7 +359,7 @@ mod tests {
359 let path = map.path_of(item).unwrap(); 359 let path = map.path_of(item).unwrap();
360 format!( 360 format!(
361 "{}::{} ({})\n", 361 "{}::{} ({})\n",
362 crate_graph[krate].display_name.as_ref().unwrap(), 362 crate_graph[krate].declaration_name.as_ref().unwrap(),
363 path, 363 path,
364 mark 364 mark
365 ) 365 )
@@ -400,7 +400,7 @@ mod tests {
400 .iter() 400 .iter()
401 .filter_map(|krate| { 401 .filter_map(|krate| {
402 let cdata = &crate_graph[krate]; 402 let cdata = &crate_graph[krate];
403 let name = cdata.display_name.as_ref()?; 403 let name = cdata.declaration_name.as_ref()?;
404 404
405 let map = db.import_map(krate); 405 let map = db.import_map(krate);
406 406
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 5e4d73c1f..464ffef21 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -173,7 +173,7 @@ 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]
176 .display_name 176 .declaration_name
177 .as_ref() 177 .as_ref()
178 .map(ToString::to_string) 178 .map(ToString::to_string)
179 .unwrap_or_default() 179 .unwrap_or_default()