aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 6d1154056..4182ca156 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -155,7 +155,7 @@ impl CargoWorkspace {
155 if let Some(target) = cargo_features.target.as_ref() { 155 if let Some(target) = cargo_features.target.as_ref() {
156 meta.other_options(vec![String::from("--filter-platform"), target.clone()]); 156 meta.other_options(vec![String::from("--filter-platform"), target.clone()]);
157 } 157 }
158 let meta = meta.exec().with_context(|| { 158 let mut meta = meta.exec().with_context(|| {
159 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display()) 159 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display())
160 })?; 160 })?;
161 161
@@ -175,6 +175,7 @@ impl CargoWorkspace {
175 175
176 let ws_members = &meta.workspace_members; 176 let ws_members = &meta.workspace_members;
177 177
178 meta.packages.sort_by(|a, b| a.id.cmp(&b.id));
178 for meta_pkg in meta.packages { 179 for meta_pkg in meta.packages {
179 let cargo_metadata::Package { id, edition, name, manifest_path, version, .. } = 180 let cargo_metadata::Package { id, edition, name, manifest_path, version, .. } =
180 meta_pkg; 181 meta_pkg;
@@ -210,7 +211,7 @@ impl CargoWorkspace {
210 } 211 }
211 } 212 }
212 let resolve = meta.resolve.expect("metadata executed with deps"); 213 let resolve = meta.resolve.expect("metadata executed with deps");
213 for node in resolve.nodes { 214 for mut node in resolve.nodes {
214 let source = match pkg_by_id.get(&node.id) { 215 let source = match pkg_by_id.get(&node.id) {
215 Some(&src) => src, 216 Some(&src) => src,
216 // FIXME: replace this and a similar branch below with `.unwrap`, once 217 // FIXME: replace this and a similar branch below with `.unwrap`, once
@@ -221,6 +222,7 @@ impl CargoWorkspace {
221 continue; 222 continue;
222 } 223 }
223 }; 224 };
225 node.deps.sort_by(|a, b| a.pkg.cmp(&b.pkg));
224 for dep_node in node.deps { 226 for dep_node in node.deps {
225 let pkg = match pkg_by_id.get(&dep_node.pkg) { 227 let pkg = match pkg_by_id.get(&dep_node.pkg) {
226 Some(&pkg) => pkg, 228 Some(&pkg) => pkg,