aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-10-20 16:04:38 +0100
committerAleksey Kladov <[email protected]>2020-10-20 16:09:03 +0100
commit3b1a648539487c08bc613b6fd6e573b0e0e38948 (patch)
treec7f1ebcc5979838d1747cf19dd562004916a7274 /crates/project_model/src
parenta85c4280bf7af3ea25c34c0cd72d05c8de17454d (diff)
More type safety around names
Diffstat (limited to 'crates/project_model/src')
-rw-r--r--crates/project_model/src/lib.rs8
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
15use anyhow::{bail, Context, Result}; 15use anyhow::{bail, Context, Result};
16use base_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; 16use base_db::{CrateDisplayName, CrateGraph, CrateId, CrateName, Edition, Env, FileId};
17use cfg::CfgOptions; 17use cfg::CfgOptions;
18use paths::{AbsPath, AbsPathBuf}; 18use paths::{AbsPath, AbsPathBuf};
19use rustc_hash::{FxHashMap, FxHashSet}; 19use 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,