about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_dev/src/bless.rs7
-rw-r--r--tests/cargo/mod.rs9
-rw-r--r--tests/compile-test.rs7
3 files changed, 3 insertions, 20 deletions
diff --git a/clippy_dev/src/bless.rs b/clippy_dev/src/bless.rs
index 19153aa74d0..3d97fa8a892 100644
--- a/clippy_dev/src/bless.rs
+++ b/clippy_dev/src/bless.rs
@@ -85,10 +85,7 @@ fn updated_since_clippy_build(path: &Path) -> Option<bool> {
 }
 
 fn build_dir() -> PathBuf {
-    let profile = env::var("PROFILE").unwrap_or_else(|_| "debug".to_string());
-    let mut path = PathBuf::new();
-    path.push(CARGO_TARGET_DIR.clone());
-    path.push(profile);
-    path.push("test_build_base");
+    let mut path = std::env::current_exe().unwrap();
+    path.set_file_name("test_build_base");
     path
 }
diff --git a/tests/cargo/mod.rs b/tests/cargo/mod.rs
index 1f3ce557eb4..4dbe71e4b6a 100644
--- a/tests/cargo/mod.rs
+++ b/tests/cargo/mod.rs
@@ -1,12 +1,3 @@
-use std::env;
-use std::lazy::SyncLazy;
-use std::path::PathBuf;
-
-pub static CARGO_TARGET_DIR: SyncLazy<PathBuf> = SyncLazy::new(|| match env::var_os("CARGO_TARGET_DIR") {
-    Some(v) => v.into(),
-    None => env::current_dir().unwrap().join("target"),
-});
-
 #[must_use]
 pub fn is_rustc_test_suite() -> bool {
     option_env!("RUSTC_TEST_SUITE").is_some()
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index 2641fb81234..d113c4d3437 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -1,5 +1,4 @@
 #![feature(test)] // compiletest_rs requires this attribute
-#![feature(once_cell)]
 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
 #![warn(rust_2018_idioms, unused_lifetimes)]
 
@@ -46,10 +45,6 @@ extern crate quote;
 #[allow(unused_extern_crates)]
 extern crate syn;
 
-fn host_lib() -> PathBuf {
-    option_env!("HOST_LIBS").map_or(cargo::CARGO_TARGET_DIR.join(env!("PROFILE")), PathBuf::from)
-}
-
 /// Produces a string with an `--extern` flag for all UI test crate
 /// dependencies.
 ///
@@ -133,7 +128,7 @@ fn default_config() -> compiletest::Config {
         extern_flags(),
     ));
 
-    config.build_base = host_lib().join("test_build_base");
+    config.build_base = profile_path.join("test_build_base");
     config.rustc_path = profile_path.join(if cfg!(windows) {
         "clippy-driver.exe"
     } else {