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;
2
1
use std:: env;
2
+ use std:: lazy:: SyncLazy ;
3
3
use std:: path:: PathBuf ;
4
4
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) ;
22
17
}
23
- } ;
24
- }
18
+ dir. push ( env ! ( "PROFILE" ) ) ;
19
+ dir
20
+ }
21
+ } ) ;
25
22
26
23
#[ must_use]
27
24
pub fn is_rustc_test_suite ( ) -> bool {
Original file line number Diff line number Diff line change 1
1
#![ feature( test) ] // compiletest_rs requires this attribute
2
+ #![ feature( once_cell) ]
2
3
3
4
use compiletest_rs as compiletest;
4
5
use compiletest_rs:: common:: Mode as TestMode ;
Original file line number Diff line number Diff line change 1
1
// Dogfood cannot run on Windows
2
2
#![ cfg( not( windows) ) ]
3
+ #![ feature( once_cell) ]
3
4
4
- use lazy_static :: lazy_static ;
5
+ use std :: lazy :: SyncLazy ;
5
6
use std:: path:: PathBuf ;
6
7
use std:: process:: Command ;
7
8
8
9
mod cargo;
9
10
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" ) ) ;
13
12
14
13
#[ test]
15
14
fn dogfood_clippy ( ) {
You can’t perform that action at this time.
0 commit comments