diff --git a/src/platform/x11.rs b/src/platform/x11.rs index 589c4753ba..2c4cef7576 100644 --- a/src/platform/x11.rs +++ b/src/platform/x11.rs @@ -80,9 +80,7 @@ pub type XWindow = u32; #[inline] pub fn register_xlib_error_hook(hook: XlibErrorHook) { // Append new hook. - unsafe { - crate::platform_impl::XLIB_ERROR_HOOKS.lock().unwrap().push(hook); - } + crate::platform_impl::XLIB_ERROR_HOOKS.lock().unwrap().push(hook); } /// Additional methods on [`ActiveEventLoop`] that are specific to X11. diff --git a/src/platform_impl/apple/uikit/app_state.rs b/src/platform_impl/apple/uikit/app_state.rs index ef1a73831d..1c33dcb63c 100644 --- a/src/platform_impl/apple/uikit/app_state.rs +++ b/src/platform_impl/apple/uikit/app_state.rs @@ -150,6 +150,8 @@ impl AppState { // must be mut because plain `static` requires `Sync` static mut APP_STATE: RefCell> = RefCell::new(None); + #[allow(unknown_lints)] // New lint below + #[allow(static_mut_refs)] // TODO: Use `MainThreadBound` instead. let mut guard = unsafe { APP_STATE.borrow_mut() }; if guard.is_none() { #[inline(never)] diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index b715e40ac2..9c553c98b7 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -276,7 +276,7 @@ pub(crate) enum PlatformCustomCursor { /// Hooks for X11 errors. #[cfg(x11_platform)] -pub(crate) static mut XLIB_ERROR_HOOKS: Mutex> = Mutex::new(Vec::new()); +pub(crate) static XLIB_ERROR_HOOKS: Mutex> = Mutex::new(Vec::new()); #[cfg(x11_platform)] unsafe extern "C" fn x_error_callback( @@ -287,7 +287,7 @@ unsafe extern "C" fn x_error_callback( if let Ok(ref xconn) = *xconn_lock { // Call all the hooks. let mut error_handled = false; - for hook in unsafe { XLIB_ERROR_HOOKS.lock() }.unwrap().iter() { + for hook in XLIB_ERROR_HOOKS.lock().unwrap().iter() { error_handled |= hook(display as *mut _, event as *mut _); }