diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-01 09:03:47 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-01 09:03:47 +0100 |
commit | 686e115e7397028a94bde57df1acf0f066651285 (patch) | |
tree | 2a854f0f74ef4865c0b4196ed0a31abd0da74e2d /crates/ra_project_model/src/lib.rs | |
parent | 30c2e714cc1677cbea40a47d7c0944c92f66b7c9 (diff) | |
parent | 80386ca5be78d8ea65483df3edeec1a89b09a5a3 (diff) |
Merge #5158
5158: Use CrateName correctly r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 8b85b4831..8dbf4e6ea 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -288,10 +288,7 @@ impl ProjectWorkspace { | |||
288 | if let (Some(&from), Some(&to)) = | 288 | if let (Some(&from), Some(&to)) = |
289 | (crates.get(&from_crate_id), crates.get(&to_crate_id)) | 289 | (crates.get(&from_crate_id), crates.get(&to_crate_id)) |
290 | { | 290 | { |
291 | if crate_graph | 291 | if crate_graph.add_dep(from, dep.name.clone(), to).is_err() { |
292 | .add_dep(from, CrateName::new(&dep.name).unwrap(), to) | ||
293 | .is_err() | ||
294 | { | ||
295 | log::error!( | 292 | log::error!( |
296 | "cyclic dependency {:?} -> {:?}", | 293 | "cyclic dependency {:?} -> {:?}", |
297 | from_crate_id, | 294 | from_crate_id, |
@@ -312,13 +309,11 @@ impl ProjectWorkspace { | |||
312 | 309 | ||
313 | let env = Env::default(); | 310 | let env = Env::default(); |
314 | let proc_macro = vec![]; | 311 | let proc_macro = vec![]; |
315 | let crate_name = CrateName::new(&sysroot[krate].name) | 312 | let name = sysroot[krate].name.clone(); |
316 | .expect("Sysroot crate names should not contain dashes"); | ||
317 | |||
318 | let crate_id = crate_graph.add_crate_root( | 313 | let crate_id = crate_graph.add_crate_root( |
319 | file_id, | 314 | file_id, |
320 | Edition::Edition2018, | 315 | Edition::Edition2018, |
321 | Some(crate_name), | 316 | Some(name), |
322 | cfg_options.clone(), | 317 | cfg_options.clone(), |
323 | env, | 318 | env, |
324 | proc_macro, | 319 | proc_macro, |
@@ -392,7 +387,7 @@ impl ProjectWorkspace { | |||
392 | let crate_id = crate_graph.add_crate_root( | 387 | let crate_id = crate_graph.add_crate_root( |
393 | file_id, | 388 | file_id, |
394 | edition, | 389 | edition, |
395 | Some(CrateName::normalize_dashes(&cargo[pkg].name)), | 390 | Some(cargo[pkg].name.clone()), |
396 | cfg_options, | 391 | cfg_options, |
397 | env, | 392 | env, |
398 | proc_macro.clone(), | 393 | proc_macro.clone(), |