Skip to content

Commit ecaf7ac

Browse files
committed
Use relative path for test builds
1 parent e3b171d commit ecaf7ac

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

clippy_dev/src/bless.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ fn updated_since_clippy_build(path: &Path) -> Option<bool> {
8585
}
8686

8787
fn build_dir() -> PathBuf {
88-
let profile = env::var("PROFILE").unwrap_or_else(|_| "debug".to_string());
89-
let mut path = PathBuf::new();
90-
path.push(CARGO_TARGET_DIR.clone());
91-
path.push(profile);
92-
path.push("test_build_base");
88+
let mut path = std::env::current_exe().unwrap();
89+
path.set_file_name("test_build_base");
9390
path
9491
}

tests/cargo/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
use std::env;
2-
use std::lazy::SyncLazy;
3-
use std::path::PathBuf;
4-
5-
pub static CARGO_TARGET_DIR: SyncLazy<PathBuf> = SyncLazy::new(|| match env::var_os("CARGO_TARGET_DIR") {
6-
Some(v) => v.into(),
7-
None => env::current_dir().unwrap().join("target"),
8-
});
9-
101
#[must_use]
112
pub fn is_rustc_test_suite() -> bool {
123
option_env!("RUSTC_TEST_SUITE").is_some()

tests/compile-test.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(test)] // compiletest_rs requires this attribute
2-
#![feature(once_cell)]
32
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
43
#![warn(rust_2018_idioms, unused_lifetimes)]
54

@@ -46,10 +45,6 @@ extern crate quote;
4645
#[allow(unused_extern_crates)]
4746
extern crate syn;
4847

49-
fn host_lib() -> PathBuf {
50-
option_env!("HOST_LIBS").map_or(cargo::CARGO_TARGET_DIR.join(env!("PROFILE")), PathBuf::from)
51-
}
52-
5348
/// Produces a string with an `--extern` flag for all UI test crate
5449
/// dependencies.
5550
///
@@ -133,7 +128,7 @@ fn default_config() -> compiletest::Config {
133128
extern_flags(),
134129
));
135130

136-
config.build_base = host_lib().join("test_build_base");
131+
config.build_base = profile_path.join("test_build_base");
137132
config.rustc_path = profile_path.join(if cfg!(windows) {
138133
"clippy-driver.exe"
139134
} else {

0 commit comments

Comments
 (0)