@@ -402,15 +402,13 @@ impl FileFailurePersistence {
402402 }
403403}
404404
405- lazy_static ! {
406- /// Used to guard access to the persistence file(s) so that a single
407- /// process will not step on its own toes.
408- ///
409- /// We don't have much protecting us should two separate process try to
410- /// write to the same file at once (depending on how atomic append mode is
411- /// on the OS), but this should be extremely rare.
412- static ref PERSISTENCE_LOCK : RwLock <( ) > = RwLock :: new( ( ) ) ;
413- }
405+ /// Used to guard access to the persistence file(s) so that a single
406+ /// process will not step on its own toes.
407+ ///
408+ /// We don't have much protecting us should two separate process try to
409+ /// write to the same file at once (depending on how atomic append mode is
410+ /// on the OS), but this should be extremely rare.
411+ static PERSISTENCE_LOCK : RwLock < ( ) > = RwLock :: new ( ( ) ) ;
414412
415413#[ cfg( test) ]
416414mod tests {
@@ -423,22 +421,20 @@ mod tests {
423421 misplaced_file : PathBuf ,
424422 }
425423
426- lazy_static ! {
427- static ref TEST_PATHS : TestPaths = {
428- let crate_root = Path :: new( env!( "CARGO_MANIFEST_DIR" ) ) ;
429- let lib_root = crate_root. join( "src" ) ;
430- let src_subdir = lib_root. join( "strategy" ) ;
431- let src_file = lib_root. join( "foo.rs" ) ;
432- let subdir_file = src_subdir. join( "foo.rs" ) ;
433- let misplaced_file = crate_root. join( "foo.rs" ) ;
434- TestPaths {
435- crate_root,
436- src_file,
437- subdir_file,
438- misplaced_file,
439- }
440- } ;
441- }
424+ static TEST_PATHS : std:: sync:: LazyLock < TestPaths > = std:: sync:: LazyLock :: new ( || {
425+ let crate_root = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
426+ let lib_root = crate_root. join ( "src" ) ;
427+ let src_subdir = lib_root. join ( "strategy" ) ;
428+ let src_file = lib_root. join ( "foo.rs" ) ;
429+ let subdir_file = src_subdir. join ( "foo.rs" ) ;
430+ let misplaced_file = crate_root. join ( "foo.rs" ) ;
431+ TestPaths {
432+ crate_root,
433+ src_file,
434+ subdir_file,
435+ misplaced_file,
436+ }
437+ } ) ;
442438
443439 #[ test]
444440 fn persistence_file_location_resolved_correctly ( ) {
@@ -502,10 +498,7 @@ mod tests {
502498 #[ test]
503499 fn relative_source_files_absolutified ( ) {
504500 const TEST_RUNNER_PATH : & [ & str ] = & [ "src" , "test_runner" , "mod.rs" ] ;
505- lazy_static ! {
506- static ref TEST_RUNNER_RELATIVE : PathBuf =
507- TEST_RUNNER_PATH . iter( ) . collect( ) ;
508- }
501+ static TEST_RUNNER_RELATIVE : std:: sync:: LazyLock < PathBuf > = std:: sync:: LazyLock :: new ( || TEST_RUNNER_PATH . iter ( ) . collect ( ) ) ;
509502 const CARGO_DIR : & str = env ! ( "CARGO_MANIFEST_DIR" ) ;
510503
511504 let expected = :: std:: iter:: once ( CARGO_DIR )
@@ -517,7 +510,7 @@ mod tests {
517510 & * expected,
518511 absolutize_source_file_with_cwd(
519512 || Ok ( Path :: new( CARGO_DIR ) . to_owned( ) ) ,
520- & TEST_RUNNER_RELATIVE
513+ & * TEST_RUNNER_RELATIVE
521514 )
522515 . unwrap( )
523516 ) ;
@@ -527,7 +520,7 @@ mod tests {
527520 & * expected,
528521 absolutize_source_file_with_cwd(
529522 || Ok ( Path :: new( CARGO_DIR ) . join( "target" ) ) ,
530- & TEST_RUNNER_RELATIVE
523+ & * TEST_RUNNER_RELATIVE
531524 )
532525 . unwrap( )
533526 ) ;
0 commit comments