From dc7937a8d43f49fd4aed50e74a150d327c3cf732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Mon, 18 Nov 2019 09:15:56 +0100 Subject: [PATCH] Don't leak missing Safety doc clippy warnings With rustc 1.40.0, clippy checks that the `unsafe` functions come with a `Safety` section. When running clippy on a downstream crate, the macros such as `gst_plugin_define!` leak the clippy warnings for the unsafe functions. Silence the warnings for now. --- gstreamer/src/iterator.rs | 4 ++-- gstreamer/src/subclass/plugin_1_12.rs | 1 + gstreamer/src/subclass/plugin_1_14.rs | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index dab6ae520..2e8d4dd16 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -352,7 +352,7 @@ where } unsafe extern "C" fn filter_boxed_ref(boxed: gpointer) -> gpointer { - let boxed = Arc::from_raw(boxed as *const (Box bool + Send + Sync + 'static>)); + let boxed = Arc::from_raw(boxed as *const Box bool + Send + Sync + 'static>); let copy = Arc::clone(&boxed); // Forget it and keep it alive, we will still need it later @@ -362,7 +362,7 @@ unsafe extern "C" fn filter_boxed_ref(boxed: gpointer) -> gpointer { } unsafe extern "C" fn filter_boxed_unref(boxed: gpointer) { - let _ = Arc::from_raw(boxed as *const (Box bool + Send + Sync + 'static>)); + let _ = Arc::from_raw(boxed as *const Box bool + Send + Sync + 'static>); } unsafe extern "C" fn filter_boxed_get_type() -> glib_sys::GType { diff --git a/gstreamer/src/subclass/plugin_1_12.rs b/gstreamer/src/subclass/plugin_1_12.rs index 095a2a7b9..924604433 100644 --- a/gstreamer/src/subclass/plugin_1_12.rs +++ b/gstreamer/src/subclass/plugin_1_12.rs @@ -64,6 +64,7 @@ macro_rules! gst_plugin_define( } } + #[allow(clippy::missing_safety_doc)] unsafe extern "C" fn plugin_init_trampoline(plugin: *mut $crate::gst_sys::GstPlugin) -> $crate::glib_sys::gboolean { use std::panic::{self, AssertUnwindSafe}; diff --git a/gstreamer/src/subclass/plugin_1_14.rs b/gstreamer/src/subclass/plugin_1_14.rs index dd5b7d803..db2aedf77 100644 --- a/gstreamer/src/subclass/plugin_1_14.rs +++ b/gstreamer/src/subclass/plugin_1_14.rs @@ -62,16 +62,19 @@ macro_rules! gst_plugin_define( $crate::paste::item! { #[no_mangle] + #[allow(clippy::missing_safety_doc)] pub unsafe extern "C" fn [] () { let _ = plugin_register_static(); } #[no_mangle] + #[allow(clippy::missing_safety_doc)] pub unsafe extern "C" fn [] () -> *const $crate::gst_sys::GstPluginDesc { &GST_PLUGIN_DESC.0 } } + #[allow(clippy::missing_safety_doc)] unsafe extern "C" fn plugin_init_trampoline(plugin: *mut $crate::gst_sys::GstPlugin) -> $crate::glib_sys::gboolean { use std::panic::{self, AssertUnwindSafe};