mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 22:53:15 -04:00
AppKit: Use fn_addr_eq now that it's in MSRV (#4532)
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#![allow(clippy::unnecessary_cast)]
|
#![allow(clippy::unnecessary_cast)]
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::mem;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::{mem, ptr};
|
||||||
|
|
||||||
use dispatch2::MainThreadBound;
|
use dispatch2::MainThreadBound;
|
||||||
use objc2::runtime::{Imp, Sel};
|
use objc2::runtime::{Imp, Sel};
|
||||||
@@ -80,9 +80,7 @@ pub(crate) fn override_send_event(global_app: &NSApplication) {
|
|||||||
let overridden = unsafe { mem::transmute::<SendEvent, Imp>(send_event) };
|
let overridden = unsafe { mem::transmute::<SendEvent, Imp>(send_event) };
|
||||||
|
|
||||||
// If we've already overridden the method, don't do anything.
|
// If we've already overridden the method, don't do anything.
|
||||||
// FIXME(madsmtm): Use `std::ptr::fn_addr_eq` (Rust 1.85) once available in MSRV.
|
if ptr::fn_addr_eq(overridden, method.implementation()) {
|
||||||
#[allow(unknown_lints, unpredictable_function_pointer_comparisons)]
|
|
||||||
if overridden == method.implementation() {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user