File tree Expand file tree Collapse file tree 3 files changed +21
-24
lines changed Expand file tree Collapse file tree 3 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 1- use lazy_static:: lazy_static;
21use std:: env;
2+ use std:: lazy:: SyncLazy ;
33use std:: path:: PathBuf ;
44
5- lazy_static ! {
6- pub static ref CARGO_TARGET_DIR : PathBuf = {
7- match env:: var_os( "CARGO_TARGET_DIR" ) {
8- Some ( v) => v. into( ) ,
9- None => env:: current_dir( ) . unwrap( ) . join( "target" ) ,
10- }
11- } ;
12- pub static ref TARGET_LIB : PathBuf = {
13- if let Some ( path) = option_env!( "TARGET_LIBS" ) {
14- path. into( )
15- } else {
16- let mut dir = CARGO_TARGET_DIR . clone( ) ;
17- if let Some ( target) = env:: var_os( "CARGO_BUILD_TARGET" ) {
18- dir. push( target) ;
19- }
20- dir. push( env!( "PROFILE" ) ) ;
21- dir
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+
10+ pub 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) ;
2217 }
23- } ;
24- }
18+ dir. push ( env ! ( "PROFILE" ) ) ;
19+ dir
20+ }
21+ } ) ;
2522
2623#[ must_use]
2724pub fn is_rustc_test_suite ( ) -> bool {
Original file line number Diff line number Diff line change 11#![ feature( test) ] // compiletest_rs requires this attribute
2+ #![ feature( once_cell) ]
23
34use compiletest_rs as compiletest;
45use compiletest_rs:: common:: Mode as TestMode ;
Original file line number Diff line number Diff line change 11// Dogfood cannot run on Windows
22#![ cfg( not( windows) ) ]
3+ #![ feature( once_cell) ]
34
4- use lazy_static :: lazy_static ;
5+ use std :: lazy :: SyncLazy ;
56use std:: path:: PathBuf ;
67use std:: process:: Command ;
78
89mod cargo;
910
10- lazy_static ! {
11- static ref CLIPPY_PATH : PathBuf = cargo:: TARGET_LIB . join( "cargo-clippy" ) ;
12- }
11+ static CLIPPY_PATH : SyncLazy < PathBuf > = SyncLazy :: new ( || cargo:: TARGET_LIB . join ( "cargo-clippy" ) ) ;
1312
1413#[ test]
1514fn dogfood_clippy ( ) {
You can’t perform that action at this time.
0 commit comments