From e35374ec7c26be8de61ec7c6175c2385ee5c006f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 10 Jan 2019 23:05:22 +0300 Subject: special case std --- crates/ra_lsp_server/src/project_model/sysroot.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ra_lsp_server/src') 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 { } impl Sysroot { - pub(crate) fn discover(cargo_toml: &Path) -> Result { + pub(crate) fn std(&self) -> Option { + self.by_name("std") + } + + pub(super) fn discover(cargo_toml: &Path) -> Result { let rustc_output = Command::new("rustc") .current_dir(cargo_toml.parent().unwrap()) .args(&["--print", "sysroot"]) @@ -50,7 +54,7 @@ impl Sysroot { }); } } - if let Some(std) = sysroot.by_name("std") { + if let Some(std) = sysroot.std() { for dep in STD_DEPS.trim().lines() { if let Some(dep) = sysroot.by_name(dep) { sysroot.crates[std].deps.push(dep) -- cgit v1.2.3