aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-26 21:18:52 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-26 21:18:52 +0000
commit691ffd2dcb687658b99f5968dbccca71e826b6a5 (patch)
tree3349722543bfee64b009db3c29b90ab546be4207 /crates/ra_lsp_server/src/project_model
parent0974e6abeb9c3f047e21c3e23769b93c9e7dcaf3 (diff)
parent9fbbb8f6096836642704e34e42c9b9ea82807e7c (diff)
Merge #681
681: Use the correct working directory for cargo metadata and rustfmt r=matklad a=DJMcNab Fixes maybe #670. @bjorn3, is that true? (Awkward wording due to GitHub's eager 'fixes' finding) Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/project_model')
-rw-r--r--crates/ra_lsp_server/src/project_model/cargo_workspace.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/src/project_model/cargo_workspace.rs b/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
index 75ae78bca..8cf99d586 100644
--- a/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
+++ b/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
@@ -117,9 +117,13 @@ impl Target {
117 117
118impl CargoWorkspace { 118impl CargoWorkspace {
119 pub fn from_cargo_metadata(cargo_toml: &Path) -> Result<CargoWorkspace> { 119 pub fn from_cargo_metadata(cargo_toml: &Path) -> Result<CargoWorkspace> {
120 let meta = MetadataCommand::new() 120 let mut meta = MetadataCommand::new();
121 .manifest_path(cargo_toml) 121 meta.manifest_path(cargo_toml)
122 .features(CargoOpt::AllFeatures) 122 .features(CargoOpt::AllFeatures);
123 if let Some(parent) = cargo_toml.parent() {
124 meta.current_dir(parent);
125 }
126 let meta = meta
123 .exec() 127 .exec()
124 .map_err(|e| format_err!("cargo metadata failed: {}", e))?; 128 .map_err(|e| format_err!("cargo metadata failed: {}", e))?;
125 let mut pkg_by_id = FxHashMap::default(); 129 let mut pkg_by_id = FxHashMap::default();