From a733f65126451784c8b158d6c6318b556d68ebfc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 26 Jan 2021 16:10:51 +0300 Subject: Allow non-absolute paths to rust source --- crates/rust-analyzer/src/config.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 071fde64d..c135913e2 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -7,7 +7,7 @@ //! configure the server itself, feature flags are passed into analysis, and //! tweak things like automatic insertion of `()` in completions. -use std::{convert::TryFrom, ffi::OsString, iter, path::PathBuf}; +use std::{ffi::OsString, iter, path::PathBuf}; use flycheck::FlycheckConfig; use hir::PrefixKind; @@ -468,11 +468,7 @@ impl Config { self.data.cargo_autoreload } pub fn cargo(&self) -> CargoConfig { - let rustc_source = self.data.rustcSource.clone().and_then(|it| { - AbsPathBuf::try_from(it) - .map_err(|_| log::error!("rustc source directory must be an absolute path")) - .ok() - }); + let rustc_source = self.data.rustcSource.as_ref().map(|it| self.root_path.join(&it)); CargoConfig { no_default_features: self.data.cargo_noDefaultFeatures, -- cgit v1.2.3