Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ path = "src/sdl2/lib.rs"
[dependencies]
bitflags = "2.10.0"
libc = "0.2.92"
lazy_static = "1.5.0"

[dependencies.sdl2-sys]
path = "sdl2-sys"
Expand Down
8 changes: 3 additions & 5 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::marker::PhantomData;
use std::mem;
use std::mem::transmute;
use std::ptr;
use std::sync::Mutex;
use std::sync::{LazyLock, Mutex};

use libc::c_int;
use libc::c_void;
Expand Down Expand Up @@ -44,10 +44,8 @@ impl CustomEventTypeMaps {
}
}

lazy_static! {
static ref CUSTOM_EVENT_TYPES: Mutex<CustomEventTypeMaps> =
Mutex::new(CustomEventTypeMaps::new());
}
static CUSTOM_EVENT_TYPES: LazyLock<Mutex<CustomEventTypeMaps>> =
LazyLock::new(|| Mutex::new(CustomEventTypeMaps::new()));

impl crate::EventSubsystem {
/// Removes all events in the event queue that match the specified event type.
Expand Down
3 changes: 0 additions & 3 deletions src/sdl2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@

pub extern crate libc;

#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate bitflags;
pub extern crate sdl2_sys as sys;
Expand Down
7 changes: 2 additions & 5 deletions tests/events.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
extern crate sdl2;
#[macro_use]
extern crate lazy_static;
use std::sync::LazyLock;

use sdl2::event;
use std::sync::Mutex;

// Since only one `Sdl` context instance can be created at a time, running tests in parallel causes
// 'Cannot initialize `Sdl` more than once at a time' error. To avoid it, run tests in serial by
// locking this mutex.
lazy_static! {
static ref CONTEXT_MUTEX: Mutex<()> = Mutex::new(());
}
static CONTEXT_MUTEX: LazyLock<Mutex<()>> = LazyLock::new(|| Mutex::new(()));

#[test]
fn test_events() {
Expand Down
Loading