aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/mock_analysis.rs
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-08 13:26:57 +0000
committerKirill Bulatov <[email protected]>2020-03-08 21:00:50 +0000
commit5cffef56e2c373f6d67b0f7b70d7ade995795c04 (patch)
tree4549fa9ccf4e204057d35f4bbc6c18987690f0ab /crates/ra_ide/src/mock_analysis.rs
parent32f5276465266522ebc01b8417feeba99bf00f6f (diff)
Consider crate declaration names
Diffstat (limited to 'crates/ra_ide/src/mock_analysis.rs')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index f4cd6deb7..90f84b052 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -99,13 +99,19 @@ impl MockAnalysis {
99 root_crate = Some(crate_graph.add_crate_root( 99 root_crate = Some(crate_graph.add_crate_root(
100 file_id, 100 file_id,
101 Edition2018, 101 Edition2018,
102 None,
102 cfg_options, 103 cfg_options,
103 Env::default(), 104 Env::default(),
104 )); 105 ));
105 } else if path.ends_with("/lib.rs") { 106 } else if path.ends_with("/lib.rs") {
106 let other_crate =
107 crate_graph.add_crate_root(file_id, Edition2018, cfg_options, Env::default());
108 let crate_name = path.parent().unwrap().file_name().unwrap(); 107 let crate_name = path.parent().unwrap().file_name().unwrap();
108 let other_crate = crate_graph.add_crate_root(
109 file_id,
110 Edition2018,
111 Some(crate_name.to_owned()),
112 cfg_options,
113 Env::default(),
114 );
109 if let Some(root_crate) = root_crate { 115 if let Some(root_crate) = root_crate {
110 crate_graph 116 crate_graph
111 .add_dep(root_crate, CrateName::new(crate_name).unwrap(), other_crate) 117 .add_dep(root_crate, CrateName::new(crate_name).unwrap(), other_crate)