aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-10 20:05:22 +0000
committerAleksey Kladov <[email protected]>2019-01-10 21:51:34 +0000
commite35374ec7c26be8de61ec7c6175c2385ee5c006f (patch)
tree9983c4cad7d1610542bf70fe2eca9705126f174c /crates/ra_lsp_server/src/project_model
parent8852408bfb358766d59b83f294148fb5eeae26a0 (diff)
special case std
Diffstat (limited to 'crates/ra_lsp_server/src/project_model')
-rw-r--r--crates/ra_lsp_server/src/project_model/sysroot.rs8
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
27impl Sysroot { 27impl 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)