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/project_model | |
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/project_model')
-rw-r--r-- | crates/project_model/src/lib.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/project_model/src/lib.rs b/crates/project_model/src/lib.rs index ea95d1c77..5db41bc16 100644 --- a/crates/project_model/src/lib.rs +++ b/crates/project_model/src/lib.rs | |||
@@ -13,7 +13,7 @@ use std::{ | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | use anyhow::{bail, Context, Result}; | 15 | use anyhow::{bail, Context, Result}; |
16 | use base_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; | 16 | use base_db::{CrateDisplayName, CrateGraph, CrateId, CrateName, Edition, Env, FileId}; |
17 | use cfg::CfgOptions; | 17 | use cfg::CfgOptions; |
18 | use paths::{AbsPath, AbsPathBuf}; | 18 | use paths::{AbsPath, AbsPathBuf}; |
19 | use rustc_hash::{FxHashMap, FxHashSet}; | 19 | use rustc_hash::{FxHashMap, FxHashSet}; |
@@ -408,10 +408,12 @@ impl ProjectWorkspace { | |||
408 | .map(|it| proc_macro_client.by_dylib_path(&it)) | 408 | .map(|it| proc_macro_client.by_dylib_path(&it)) |
409 | .unwrap_or_default(); | 409 | .unwrap_or_default(); |
410 | 410 | ||
411 | let display_name = | ||
412 | CrateDisplayName::from_canonical_name(cargo[pkg].name.clone()); | ||
411 | let crate_id = crate_graph.add_crate_root( | 413 | let crate_id = crate_graph.add_crate_root( |
412 | file_id, | 414 | file_id, |
413 | edition, | 415 | edition, |
414 | Some(CrateName::normalize_dashes(&cargo[pkg].name)), | 416 | Some(display_name), |
415 | cfg_options, | 417 | cfg_options, |
416 | env, | 418 | env, |
417 | proc_macro.clone(), | 419 | proc_macro.clone(), |
@@ -556,7 +558,7 @@ fn sysroot_to_crate_graph( | |||
556 | let crate_id = crate_graph.add_crate_root( | 558 | let crate_id = crate_graph.add_crate_root( |
557 | file_id, | 559 | file_id, |
558 | Edition::Edition2018, | 560 | Edition::Edition2018, |
559 | Some(name), | 561 | Some(name.into()), |
560 | cfg_options.clone(), | 562 | cfg_options.clone(), |
561 | env, | 563 | env, |
562 | proc_macro, | 564 | proc_macro, |