diff options
Diffstat (limited to 'crates/ra_lsp_server')
-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) |