mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 17:33:07 +00:00
integration tests: Replace lazy_static with SyncLazy
This commit is contained in:
parent
4b459596a9
commit
9b4ceee593
@ -1,27 +1,24 @@
|
||||
use lazy_static::lazy_static;
|
||||
use std::env;
|
||||
use std::lazy::SyncLazy;
|
||||
use std::path::PathBuf;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref CARGO_TARGET_DIR: PathBuf = {
|
||||
match env::var_os("CARGO_TARGET_DIR") {
|
||||
Some(v) => v.into(),
|
||||
None => env::current_dir().unwrap().join("target"),
|
||||
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"),
|
||||
});
|
||||
|
||||
pub static TARGET_LIB: SyncLazy<PathBuf> = SyncLazy::new(|| {
|
||||
if let Some(path) = option_env!("TARGET_LIBS") {
|
||||
path.into()
|
||||
} else {
|
||||
let mut dir = CARGO_TARGET_DIR.clone();
|
||||
if let Some(target) = env::var_os("CARGO_BUILD_TARGET") {
|
||||
dir.push(target);
|
||||
}
|
||||
};
|
||||
pub static ref TARGET_LIB: PathBuf = {
|
||||
if let Some(path) = option_env!("TARGET_LIBS") {
|
||||
path.into()
|
||||
} else {
|
||||
let mut dir = CARGO_TARGET_DIR.clone();
|
||||
if let Some(target) = env::var_os("CARGO_BUILD_TARGET") {
|
||||
dir.push(target);
|
||||
}
|
||||
dir.push(env!("PROFILE"));
|
||||
dir
|
||||
}
|
||||
};
|
||||
}
|
||||
dir.push(env!("PROFILE"));
|
||||
dir
|
||||
}
|
||||
});
|
||||
|
||||
#[must_use]
|
||||
pub fn is_rustc_test_suite() -> bool {
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![feature(test)] // compiletest_rs requires this attribute
|
||||
#![feature(once_cell)]
|
||||
|
||||
use compiletest_rs as compiletest;
|
||||
use compiletest_rs::common::Mode as TestMode;
|
||||
|
@ -1,15 +1,14 @@
|
||||
// Dogfood cannot run on Windows
|
||||
#![cfg(not(windows))]
|
||||
#![feature(once_cell)]
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use std::lazy::SyncLazy;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
mod cargo;
|
||||
|
||||
lazy_static! {
|
||||
static ref CLIPPY_PATH: PathBuf = cargo::TARGET_LIB.join("cargo-clippy");
|
||||
}
|
||||
static CLIPPY_PATH: SyncLazy<PathBuf> = SyncLazy::new(|| cargo::TARGET_LIB.join("cargo-clippy"));
|
||||
|
||||
#[test]
|
||||
fn dogfood_clippy() {
|
||||
|
Loading…
Reference in New Issue
Block a user