From d62dd63256315a037260f81a98283110511696f1 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 22 Mar 2020 01:09:38 +0800 Subject: Use target-name for crate-name --- crates/ra_project_model/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index b500a74fb..a3ef9acdc 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs @@ -336,7 +336,7 @@ impl ProjectWorkspace { extern_source, ); if cargo[tgt].kind == TargetKind::Lib { - lib_tgt = Some(crate_id); + lib_tgt = Some((crate_id, cargo[tgt].name.clone())); pkg_to_lib_crate.insert(pkg, crate_id); } if cargo[tgt].is_proc_macro { @@ -363,7 +363,7 @@ impl ProjectWorkspace { // Set deps to the core, std and to the lib target of the current package for &from in pkg_crates.get(&pkg).into_iter().flatten() { - if let Some(to) = lib_tgt { + if let Some((to, name)) = lib_tgt.clone() { if to != from && crate_graph .add_dep( @@ -371,7 +371,7 @@ impl ProjectWorkspace { // For root projects with dashes in their name, // cargo metadata does not do any normalization, // so we do it ourselves currently - CrateName::normalize_dashes(&cargo[pkg].name), + CrateName::normalize_dashes(&name), to, ) .is_err() -- cgit v1.2.3