]> git.lizzy.rs Git - rust.git/commitdiff
Allow non-absolute paths to rust source
authorAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 26 Jan 2021 13:10:51 +0000 (16:10 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 26 Jan 2021 13:40:08 +0000 (16:40 +0300)
crates/rust-analyzer/src/config.rs

index 071fde64dead0e7e808d5d4fe3ded46cf6fb689a..c135913e2720465afb2921fab72de88e1d26f0ae 100644 (file)
@@ -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 @@ pub fn cargo_autoreload(&self) -> bool {
         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,