]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/cargo/mod.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / cargo / mod.rs
CommitLineData
f20569fa
XL
1use std::env;
2use std::lazy::SyncLazy;
3use std::path::PathBuf;
4
5pub 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
10pub static TARGET_LIB: SyncLazy<PathBuf> = SyncLazy::new(|| {
11 if let Some(path) = option_env!("TARGET_LIBS") {
12 path.into()
13 } else {
14 let mut dir = CARGO_TARGET_DIR.clone();
15 if let Some(target) = env::var_os("CARGO_BUILD_TARGET") {
16 dir.push(target);
17 }
18 dir.push(env!("PROFILE"));
19 dir
20 }
21});
22
23#[must_use]
24pub fn is_rustc_test_suite() -> bool {
25 option_env!("RUSTC_TEST_SUITE").is_some()
26}