diff options
author | Aleksey Kladov <[email protected]> | 2019-01-10 20:05:22 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-10 21:51:34 +0000 |
commit | e35374ec7c26be8de61ec7c6175c2385ee5c006f (patch) | |
tree | 9983c4cad7d1610542bf70fe2eca9705126f174c /crates | |
parent | 8852408bfb358766d59b83f294148fb5eeae26a0 (diff) |
special case std
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_lsp_server/src/project_model/sysroot.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/project_model/sysroot.rs b/crates/ra_lsp_server/src/project_model/sysroot.rs index 6c1a1a2a3..c4028a1fe 100644 --- a/crates/ra_lsp_server/src/project_model/sysroot.rs +++ b/crates/ra_lsp_server/src/project_model/sysroot.rs | |||
@@ -25,7 +25,11 @@ struct SysrootCrateData { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | impl Sysroot { | 27 | impl Sysroot { |
28 | pub(crate) fn discover(cargo_toml: &Path) -> Result<Sysroot> { | 28 | pub(crate) fn std(&self) -> Option<SysrootCrate> { |
29 | self.by_name("std") | ||
30 | } | ||
31 | |||
32 | pub(super) fn discover(cargo_toml: &Path) -> Result<Sysroot> { | ||
29 | let rustc_output = Command::new("rustc") | 33 | let rustc_output = Command::new("rustc") |
30 | .current_dir(cargo_toml.parent().unwrap()) | 34 | .current_dir(cargo_toml.parent().unwrap()) |
31 | .args(&["--print", "sysroot"]) | 35 | .args(&["--print", "sysroot"]) |
@@ -50,7 +54,7 @@ impl Sysroot { | |||
50 | }); | 54 | }); |
51 | } | 55 | } |
52 | } | 56 | } |
53 | if let Some(std) = sysroot.by_name("std") { | 57 | if let Some(std) = sysroot.std() { |
54 | for dep in STD_DEPS.trim().lines() { | 58 | for dep in STD_DEPS.trim().lines() { |
55 | if let Some(dep) = sysroot.by_name(dep) { | 59 | if let Some(dep) = sysroot.by_name(dep) { |
56 | sysroot.crates[std].deps.push(dep) | 60 | sysroot.crates[std].deps.push(dep) |