diff options
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 55b94b911..676dc4941 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -57,6 +57,10 @@ impl PackageRoot { | |||
57 | 57 | ||
58 | impl ProjectWorkspace { | 58 | impl ProjectWorkspace { |
59 | pub fn discover(path: &Path) -> Result<ProjectWorkspace> { | 59 | pub fn discover(path: &Path) -> Result<ProjectWorkspace> { |
60 | ProjectWorkspace::discover_with_sysroot(path, true) | ||
61 | } | ||
62 | |||
63 | pub fn discover_with_sysroot(path: &Path, with_sysroot: bool) -> Result<ProjectWorkspace> { | ||
60 | match find_rust_project_json(path) { | 64 | match find_rust_project_json(path) { |
61 | Some(json_path) => { | 65 | Some(json_path) => { |
62 | let file = File::open(json_path)?; | 66 | let file = File::open(json_path)?; |
@@ -65,10 +69,10 @@ impl ProjectWorkspace { | |||
65 | } | 69 | } |
66 | None => { | 70 | None => { |
67 | let cargo_toml = find_cargo_toml(path)?; | 71 | let cargo_toml = find_cargo_toml(path)?; |
68 | Ok(ProjectWorkspace::Cargo { | 72 | let cargo = CargoWorkspace::from_cargo_metadata(&cargo_toml)?; |
69 | cargo: CargoWorkspace::from_cargo_metadata(&cargo_toml)?, | 73 | let sysroot = |
70 | sysroot: Sysroot::discover(&cargo_toml)?, | 74 | if with_sysroot { Sysroot::discover(&cargo_toml)? } else { Sysroot::default() }; |
71 | }) | 75 | Ok(ProjectWorkspace::Cargo { cargo, sysroot }) |
72 | } | 76 | } |
73 | } | 77 | } |
74 | } | 78 | } |