From 4dade30f0d0d3918ff7c53475468af18ff4afcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 30 Jun 2022 15:22:30 +0300 Subject: [PATCH] Fix/silence a couple new clippy warnings --- gstreamer-base/src/subclass/push_src.rs | 6 ++---- gstreamer-sdp/src/sdp_media.rs | 6 +++--- gstreamer-sdp/src/sdp_message.rs | 6 +++--- gstreamer-video/src/video_message.rs | 12 +++++------- gstreamer/src/param_spec.rs | 4 ++-- gstreamer/src/task.rs | 2 ++ 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 5c1b4355f..7064b7f4c 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -275,7 +275,7 @@ unsafe extern "C" fn push_src_create( .instance_data::(crate::BaseSrc::static_type()) .unwrap(); - let res = gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match PushSrcImpl::create(imp, wrap.unsafe_cast_ref(), buffer.as_deref_mut()) { Ok(CreateSuccess::NewBuffer(new_buffer)) => { // Clear any pending buffer list @@ -357,7 +357,5 @@ unsafe extern "C" fn push_src_create( Err(err) => gst::FlowReturn::from(err), } }) - .into_glib(); - - res + .into_glib() } diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index 61bbf24a4..203feedbb 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -68,13 +68,13 @@ impl ops::DerefMut for SDPMedia { impl fmt::Debug for SDPMedia { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::fmt(&*self, f) + ::fmt(self, f) } } impl fmt::Display for SDPMedia { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::fmt(&*self, f) + ::fmt(self, f) } } @@ -629,7 +629,7 @@ impl SDPMediaRef { impl Borrow for SDPMedia { fn borrow(&self) -> &SDPMediaRef { - &*self + self } } diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index aa12d36f0..18e5f4723 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -61,13 +61,13 @@ impl ops::DerefMut for SDPMessage { impl fmt::Debug for SDPMessage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::fmt(&*self, f) + ::fmt(self, f) } } impl fmt::Display for SDPMessage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::fmt(&*self, f) + ::fmt(self, f) } } @@ -935,7 +935,7 @@ impl SDPMessageRef { impl Borrow for SDPMessage { fn borrow(&self) -> &SDPMessageRef { - &*self + self } } diff --git a/gstreamer-video/src/video_message.rs b/gstreamer-video/src/video_message.rs index efdce81da..a061ca65b 100644 --- a/gstreamer-video/src/video_message.rs +++ b/gstreamer-video/src/video_message.rs @@ -177,7 +177,7 @@ impl NavigationEventMessage { } } -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, PartialEq, Eq, Debug)] pub enum NavigationMessage { Event(NavigationEventMessage), } @@ -197,12 +197,10 @@ impl NavigationMessage { match event_type { NavigationMessageType::Event => NavigationEventMessage::parse(msg).map(Self::Event), - _ => { - return Err(glib::bool_error!( - "Unsupported navigation msg {:?}", - event_type - )) - } + _ => Err(glib::bool_error!( + "Unsupported navigation msg {:?}", + event_type + )), } } } diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index d12d26c6f..53e46e90c 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -99,7 +99,7 @@ impl ParamSpecFraction { } pub fn upcast_ref(&self) -> &ParamSpec { - &*self + self } } @@ -255,7 +255,7 @@ impl ParamSpecArray { } pub fn upcast_ref(&self) -> &ParamSpec { - &*self + self } } diff --git a/gstreamer/src/task.rs b/gstreamer/src/task.rs index 8ca56480e..7c40a3814 100644 --- a/gstreamer/src/task.rs +++ b/gstreamer/src/task.rs @@ -9,6 +9,7 @@ use std::sync::Arc; use glib::prelude::*; use glib::translate::*; +#[allow(clippy::type_complexity)] pub struct TaskBuilder { func: Box<(F, *mut ffi::GstTask)>, lock: Option, @@ -65,6 +66,7 @@ impl TaskBuilder { callback(&from_glib_borrow(task)); } + #[allow(clippy::type_complexity)] unsafe extern "C" fn destroy_callback(data: glib::ffi::gpointer) { let _callback: Box> = Box::from_raw(data as *mut _);