From 313c392c25e1c3130c3714964976f212093e5fae Mon Sep 17 00:00:00 2001 From: xuyizhe Date: Thu, 15 Oct 2020 18:26:32 +0800 Subject: [PATCH] Fix checking order for RUST_SRC_PATH --- src/racer/util.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/racer/util.rs b/src/racer/util.rs index ebd59f8f..2440e520 100644 --- a/src/racer/util.rs +++ b/src/racer/util.rs @@ -451,16 +451,16 @@ fn check_rust_sysroot() -> Option { if let Ok(output) = cmd.output() { if let Ok(s) = String::from_utf8(output.stdout) { let sysroot = path::Path::new(s.trim()); - let srcpath = sysroot.join("lib/rustlib/src/rust/src"); - if srcpath.exists() { - return Some(srcpath); - } // See if the toolchain is sufficiently new, after the libstd // has been internally reorganized let srcpath = sysroot.join("lib/rustlib/src/rust/library"); if srcpath.exists() { return Some(srcpath); } + let srcpath = sysroot.join("lib/rustlib/src/rust/src"); + if srcpath.exists() { + return Some(srcpath); + } } } None @@ -545,7 +545,6 @@ fn validate_rust_src_path(path: path::PathBuf) -> Result