From cd39327ea2fd35b7921b9e8d33fd4a6ced37e019 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Mon, 11 Nov 2019 14:50:31 -0800 Subject: [PATCH] Fix invalid_value lint triggering on mem::zeroed of CFRunLoopSourceContext (#1271) --- src/platform_impl/macos/event_loop.rs | 2 +- src/platform_impl/macos/observer.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs index f3df1b52..d6d89092 100644 --- a/src/platform_impl/macos/event_loop.rs +++ b/src/platform_impl/macos/event_loop.rs @@ -132,7 +132,7 @@ impl Proxy { // process user events through the normal OS EventLoop mechanisms. let rl = CFRunLoopGetMain(); let mut context: CFRunLoopSourceContext = mem::zeroed(); - context.perform = event_loop_proxy_handler; + context.perform = Some(event_loop_proxy_handler); let source = CFRunLoopSourceCreate(ptr::null_mut(), CFIndex::max_value() - 1, &mut context); CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes); diff --git a/src/platform_impl/macos/observer.rs b/src/platform_impl/macos/observer.rs index 10e78e0e..edd8e994 100644 --- a/src/platform_impl/macos/observer.rs +++ b/src/platform_impl/macos/observer.rs @@ -93,14 +93,14 @@ pub enum CFRunLoopTimerContext {} pub struct CFRunLoopSourceContext { pub version: CFIndex, pub info: *mut c_void, - pub retain: extern "C" fn(*const c_void) -> *const c_void, - pub release: extern "C" fn(*const c_void), - pub copyDescription: extern "C" fn(*const c_void) -> CFStringRef, - pub equal: extern "C" fn(*const c_void, *const c_void) -> ffi::Boolean, - pub hash: extern "C" fn(*const c_void) -> CFHashCode, - pub schedule: extern "C" fn(*mut c_void, CFRunLoopRef, CFRunLoopMode), - pub cancel: extern "C" fn(*mut c_void, CFRunLoopRef, CFRunLoopMode), - pub perform: extern "C" fn(*mut c_void), + pub retain: Option *const c_void>, + pub release: Option, + pub copyDescription: Option CFStringRef>, + pub equal: Option ffi::Boolean>, + pub hash: Option CFHashCode>, + pub schedule: Option, + pub cancel: Option, + pub perform: Option, } // begin is queued with the highest priority to ensure it is processed before other observers