File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ path = "src/sdl2/lib.rs"
1919[dependencies ]
2020bitflags = " 2.10.0"
2121libc = " 0.2.92"
22- lazy_static = " 1.5.0"
2322
2423[dependencies .sdl2-sys ]
2524path = " sdl2-sys"
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use std::marker::PhantomData;
99use std:: mem;
1010use std:: mem:: transmute;
1111use std:: ptr;
12- use std:: sync:: Mutex ;
12+ use std:: sync:: { LazyLock , Mutex } ;
1313
1414use libc:: c_int;
1515use libc:: c_void;
@@ -44,10 +44,8 @@ impl CustomEventTypeMaps {
4444 }
4545}
4646
47- lazy_static ! {
48- static ref CUSTOM_EVENT_TYPES : Mutex <CustomEventTypeMaps > =
49- Mutex :: new( CustomEventTypeMaps :: new( ) ) ;
50- }
47+ static CUSTOM_EVENT_TYPES : LazyLock < Mutex < CustomEventTypeMaps > > =
48+ LazyLock :: new ( || Mutex :: new ( CustomEventTypeMaps :: new ( ) ) ) ;
5149
5250impl crate :: EventSubsystem {
5351 /// Removes all events in the event queue that match the specified event type.
Original file line number Diff line number Diff line change 5050
5151pub extern crate libc;
5252
53- #[ macro_use]
54- extern crate lazy_static;
55-
5653#[ macro_use]
5754extern crate bitflags;
5855pub extern crate sdl2_sys as sys;
Original file line number Diff line number Diff line change 11extern crate sdl2;
2- #[ macro_use]
3- extern crate lazy_static;
2+ use std:: sync:: LazyLock ;
43
54use sdl2:: event;
65use std:: sync:: Mutex ;
76
87// Since only one `Sdl` context instance can be created at a time, running tests in parallel causes
98// 'Cannot initialize `Sdl` more than once at a time' error. To avoid it, run tests in serial by
109// locking this mutex.
11- lazy_static ! {
12- static ref CONTEXT_MUTEX : Mutex <( ) > = Mutex :: new( ( ) ) ;
13- }
10+ static CONTEXT_MUTEX : LazyLock < Mutex < ( ) > > = LazyLock :: new ( || Mutex :: new ( ( ) ) ) ;
1411
1512#[ test]
1613fn test_events ( ) {
You can’t perform that action at this time.
0 commit comments