diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 9c275e6ed8..c04a5c6b22 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -39,7 +39,7 @@ static CONFIG: Lazy> = Lazy::new(|| { // // This allows us to inject event into the event loop without going through `ndk-glue` and // calling unsafe function that should only be called by Android. -static INTERNAL_EVENT: Lazy>> = Lazy::new(|| RwLock::new(None)); +static INTERNAL_EVENT: RwLock> = RwLock::new(None); enum InternalEvent { RedrawRequested, diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index a4ced5afd8..eb0b12e2c9 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -590,8 +590,7 @@ impl Window { /// Hooks for X11 errors. #[cfg(feature = "x11")] -pub(crate) static mut XLIB_ERROR_HOOKS: Lazy>> = - Lazy::new(|| Mutex::new(Vec::new())); +pub(crate) static mut XLIB_ERROR_HOOKS: Mutex> = Mutex::new(Vec::new()); #[cfg(feature = "x11")] unsafe extern "C" fn x_error_callback( diff --git a/src/platform_impl/linux/x11/ime/input_method.rs b/src/platform_impl/linux/x11/ime/input_method.rs index fecea81aba..7c68473997 100644 --- a/src/platform_impl/linux/x11/ime/input_method.rs +++ b/src/platform_impl/linux/x11/ime/input_method.rs @@ -7,11 +7,9 @@ use std::{ sync::{Arc, Mutex}, }; -use once_cell::sync::Lazy; - use super::{ffi, util, XConnection, XError}; -static GLOBAL_LOCK: Lazy> = Lazy::new(Default::default); +static GLOBAL_LOCK: Mutex<()> = Mutex::new(()); unsafe fn open_im(xconn: &Arc, locale_modifiers: &CStr) -> Option { let _lock = GLOBAL_LOCK.lock(); diff --git a/src/platform_impl/linux/x11/monitor.rs b/src/platform_impl/linux/x11/monitor.rs index 9ee7d84b42..61c49b0869 100644 --- a/src/platform_impl/linux/x11/monitor.rs +++ b/src/platform_impl/linux/x11/monitor.rs @@ -2,8 +2,6 @@ use std::os::raw::*; use std::slice; use std::sync::Mutex; -use once_cell::sync::Lazy; - use super::{ ffi::{ RRCrtc, RRCrtcChangeNotifyMask, RRMode, RROutputPropertyNotifyMask, @@ -20,7 +18,7 @@ use crate::{ // Used for testing. This should always be committed as false. const DISABLE_MONITOR_LIST_CACHING: bool = false; -static MONITORS: Lazy>>> = Lazy::new(Mutex::default); +static MONITORS: Mutex>> = Mutex::new(None); pub fn invalidate_cached_monitor_list() -> Option> { // We update this lazily. diff --git a/src/platform_impl/linux/x11/util/wm.rs b/src/platform_impl/linux/x11/util/wm.rs index 368a059cfe..385005f12c 100644 --- a/src/platform_impl/linux/x11/util/wm.rs +++ b/src/platform_impl/linux/x11/util/wm.rs @@ -1,13 +1,11 @@ use std::sync::Mutex; -use once_cell::sync::Lazy; - use super::*; // This info is global to the window manager. -static SUPPORTED_HINTS: Lazy>> = - Lazy::new(|| Mutex::new(Vec::with_capacity(0))); -static WM_NAME: Lazy>> = Lazy::new(|| Mutex::new(None)); +static SUPPORTED_HINTS: Mutex> = Mutex::new(Vec::new()); + +static WM_NAME: Mutex> = Mutex::new(None); pub fn hint_is_supported(hint: ffi::Atom) -> bool { (*SUPPORTED_HINTS.lock().unwrap()).contains(&hint)