diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-19 13:42:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-19 13:42:06 +0100 |
commit | c7d37e424f1e04f87982233f97e1e9385191b7f1 (patch) | |
tree | 90a43945782c23458a56a5c01f4adf4586b0ca85 /crates/ra_project_model | |
parent | 3ba9bc493fad9270dac74250d0b557495fe7d109 (diff) | |
parent | 7cd9b1dd7a91fb3b1e400fd4b47333c9699381f7 (diff) |
Merge #1703
1703: don't load sysroot in most heavy tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 12 | ||||
-rw-r--r-- | crates/ra_project_model/src/sysroot.rs | 2 |
2 files changed, 9 insertions, 5 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 | } |
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 3f34d51cc..2a7927f7e 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -7,7 +7,7 @@ use ra_arena::{impl_arena_id, Arena, RawId}; | |||
7 | 7 | ||
8 | use crate::Result; | 8 | use crate::Result; |
9 | 9 | ||
10 | #[derive(Debug, Clone)] | 10 | #[derive(Default, Debug, Clone)] |
11 | pub struct Sysroot { | 11 | pub struct Sysroot { |
12 | crates: Arena<SysrootCrate, SysrootCrateData>, | 12 | crates: Arena<SysrootCrate, SysrootCrateData>, |
13 | } | 13 | } |