Fix/silence a couple new clippy warnings

This commit is contained in:
Sebastian Dröge 2022-06-30 15:22:30 +03:00 committed by Sebastian Dröge
parent f30fcbcf9a
commit 4dade30f0d
6 changed files with 17 additions and 19 deletions

View file

@ -275,7 +275,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
.instance_data::<super::base_src::InstanceData>(crate::BaseSrc::static_type()) .instance_data::<super::base_src::InstanceData>(crate::BaseSrc::static_type())
.unwrap(); .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()) { match PushSrcImpl::create(imp, wrap.unsafe_cast_ref(), buffer.as_deref_mut()) {
Ok(CreateSuccess::NewBuffer(new_buffer)) => { Ok(CreateSuccess::NewBuffer(new_buffer)) => {
// Clear any pending buffer list // Clear any pending buffer list
@ -357,7 +357,5 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
Err(err) => gst::FlowReturn::from(err), Err(err) => gst::FlowReturn::from(err),
} }
}) })
.into_glib(); .into_glib()
res
} }

View file

@ -68,13 +68,13 @@ impl ops::DerefMut for SDPMedia {
impl fmt::Debug for SDPMedia { impl fmt::Debug for SDPMedia {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<SDPMediaRef as fmt::Debug>::fmt(&*self, f) <SDPMediaRef as fmt::Debug>::fmt(self, f)
} }
} }
impl fmt::Display for SDPMedia { impl fmt::Display for SDPMedia {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<SDPMediaRef as fmt::Display>::fmt(&*self, f) <SDPMediaRef as fmt::Display>::fmt(self, f)
} }
} }
@ -629,7 +629,7 @@ impl SDPMediaRef {
impl Borrow<SDPMediaRef> for SDPMedia { impl Borrow<SDPMediaRef> for SDPMedia {
fn borrow(&self) -> &SDPMediaRef { fn borrow(&self) -> &SDPMediaRef {
&*self self
} }
} }

View file

@ -61,13 +61,13 @@ impl ops::DerefMut for SDPMessage {
impl fmt::Debug for SDPMessage { impl fmt::Debug for SDPMessage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<SDPMessageRef as fmt::Debug>::fmt(&*self, f) <SDPMessageRef as fmt::Debug>::fmt(self, f)
} }
} }
impl fmt::Display for SDPMessage { impl fmt::Display for SDPMessage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<SDPMessageRef as fmt::Display>::fmt(&*self, f) <SDPMessageRef as fmt::Display>::fmt(self, f)
} }
} }
@ -935,7 +935,7 @@ impl SDPMessageRef {
impl Borrow<SDPMessageRef> for SDPMessage { impl Borrow<SDPMessageRef> for SDPMessage {
fn borrow(&self) -> &SDPMessageRef { fn borrow(&self) -> &SDPMessageRef {
&*self self
} }
} }

View file

@ -177,7 +177,7 @@ impl NavigationEventMessage {
} }
} }
#[derive(Clone, PartialEq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
pub enum NavigationMessage { pub enum NavigationMessage {
Event(NavigationEventMessage), Event(NavigationEventMessage),
} }
@ -197,12 +197,10 @@ impl NavigationMessage {
match event_type { match event_type {
NavigationMessageType::Event => NavigationEventMessage::parse(msg).map(Self::Event), NavigationMessageType::Event => NavigationEventMessage::parse(msg).map(Self::Event),
_ => { _ => Err(glib::bool_error!(
return Err(glib::bool_error!( "Unsupported navigation msg {:?}",
"Unsupported navigation msg {:?}", event_type
event_type )),
))
}
} }
} }
} }

View file

@ -99,7 +99,7 @@ impl ParamSpecFraction {
} }
pub fn upcast_ref(&self) -> &ParamSpec { pub fn upcast_ref(&self) -> &ParamSpec {
&*self self
} }
} }
@ -255,7 +255,7 @@ impl ParamSpecArray {
} }
pub fn upcast_ref(&self) -> &ParamSpec { pub fn upcast_ref(&self) -> &ParamSpec {
&*self self
} }
} }

View file

@ -9,6 +9,7 @@ use std::sync::Arc;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::*; use glib::translate::*;
#[allow(clippy::type_complexity)]
pub struct TaskBuilder<F: FnMut(&Task) + Send + 'static> { pub struct TaskBuilder<F: FnMut(&Task) + Send + 'static> {
func: Box<(F, *mut ffi::GstTask)>, func: Box<(F, *mut ffi::GstTask)>,
lock: Option<TaskLock>, lock: Option<TaskLock>,
@ -65,6 +66,7 @@ impl<F: FnMut(&Task) + Send + 'static> TaskBuilder<F> {
callback(&from_glib_borrow(task)); callback(&from_glib_borrow(task));
} }
#[allow(clippy::type_complexity)]
unsafe extern "C" fn destroy_callback(data: glib::ffi::gpointer) { unsafe extern "C" fn destroy_callback(data: glib::ffi::gpointer) {
let _callback: Box<Box<dyn FnMut(&Task) + Send + 'static>> = let _callback: Box<Box<dyn FnMut(&Task) + Send + 'static>> =
Box::from_raw(data as *mut _); Box::from_raw(data as *mut _);