diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index 06d6747b3..f9986c01a 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -216,7 +216,7 @@ fn example_main() -> Result<(), Error> { None => return, }; - match connect_rtpbin_srcpad(&src_pad, &depay) { + match connect_rtpbin_srcpad(src_pad, &depay) { Ok(_) => (), Err(err) => { element_error!( diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index bf4ed843d..64195a09c 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -63,7 +63,7 @@ fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result Result<(), Error> { - let sinkpad = static_pad(&sink, "sink")?; + let sinkpad = static_pad(sink, "sink")?; src_pad.link(&sinkpad)?; Ok(()) @@ -136,7 +136,7 @@ fn example_main() -> Result<(), Error> { srcpad.link(&sinkpad)?; src.connect_pad_added( - move |decodebin, src_pad| match connect_decodebin_pad(&src_pad, &conv) { + move |decodebin, src_pad| match connect_decodebin_pad(src_pad, &conv) { Ok(_) => (), Err(err) => { element_error!( diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index 91c4cf112..e5db64901 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -134,11 +134,11 @@ impl AppSinkCallbacksBuilder { fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) { skip_assert_initialized!(); if let Some(cause) = err.downcast_ref::<&str>() { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]); } else if let Some(cause) = err.downcast_ref::() { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]); } else { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); } } @@ -148,7 +148,7 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsink); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return; } @@ -175,7 +175,7 @@ unsafe extern "C" fn trampoline_new_preroll( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsink); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return gst::FlowReturn::Error.into_glib(); } @@ -208,7 +208,7 @@ unsafe extern "C" fn trampoline_new_sample( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsink); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return gst::FlowReturn::Error.into_glib(); } @@ -533,7 +533,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -561,7 +561,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -589,7 +589,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -617,7 +617,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -645,7 +645,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -673,7 +673,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -703,7 +703,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -729,7 +729,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -757,7 +757,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -785,7 +785,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -811,7 +811,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -839,7 +839,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); @@ -867,7 +867,7 @@ impl AppSink { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) + f(AppSink::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box = Box::new(f); diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 76b2e2ae7..07ee101e6 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -111,11 +111,11 @@ impl AppSrcCallbacksBuilder { fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) { skip_assert_initialized!(); if let Some(cause) = err.downcast_ref::<&str>() { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]); } else if let Some(cause) = err.downcast_ref::() { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]); } else { - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); } } @@ -129,7 +129,7 @@ unsafe extern "C" fn trampoline_need_data( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsrc); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return; } @@ -153,7 +153,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsrc); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return; } @@ -179,7 +179,7 @@ unsafe extern "C" fn trampoline_seek_data( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsrc); - gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); + gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]); return false.into_glib(); } diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index a73a9ba9c..aa55639bb 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::use_self)] +#[allow(clippy::needless_borrow)] mod auto; pub use crate::auto::*; diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 5ff79b351..9ecb59d2f 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -555,7 +555,7 @@ unsafe extern "C" fn audio_decoder_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -574,7 +574,7 @@ unsafe extern "C" fn audio_decoder_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -593,7 +593,7 @@ unsafe extern "C" fn audio_decoder_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -612,7 +612,7 @@ unsafe extern "C" fn audio_decoder_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -632,7 +632,7 @@ unsafe extern "C" fn audio_decoder_set_format( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { Ok(()) => true, Err(err) => { @@ -654,7 +654,7 @@ unsafe extern "C" fn audio_decoder_parse( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) { Ok((new_offset, new_len)) => { assert!(new_offset <= std::i32::MAX as u32); @@ -680,7 +680,7 @@ unsafe extern "C" fn audio_decoder_handle_frame( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame( wrap.unsafe_cast_ref(), Option::::from_glib_none(buffer).as_ref(), @@ -698,7 +698,7 @@ unsafe extern "C" fn audio_decoder_pre_push( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { Ok(Some(new_buffer)) => { *buffer = new_buffer.into_ptr(); @@ -723,7 +723,7 @@ unsafe extern "C" fn audio_decoder_flush( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard)) }) } @@ -735,7 +735,7 @@ unsafe extern "C" fn audio_decoder_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiate(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -755,7 +755,7 @@ unsafe extern "C" fn audio_decoder_getcaps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { AudioDecoderImpl::caps( imp, wrap.unsafe_cast_ref(), @@ -775,7 +775,7 @@ unsafe extern "C" fn audio_decoder_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -789,7 +789,7 @@ unsafe extern "C" fn audio_decoder_sink_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -803,7 +803,7 @@ unsafe extern "C" fn audio_decoder_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -817,7 +817,7 @@ unsafe extern "C" fn audio_decoder_src_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -832,7 +832,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { @@ -853,7 +853,7 @@ unsafe extern "C" fn audio_decoder_decide_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 3c94590de..6471cc0e2 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -504,7 +504,7 @@ unsafe extern "C" fn audio_encoder_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -523,7 +523,7 @@ unsafe extern "C" fn audio_encoder_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -542,7 +542,7 @@ unsafe extern "C" fn audio_encoder_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -561,7 +561,7 @@ unsafe extern "C" fn audio_encoder_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -581,7 +581,7 @@ unsafe extern "C" fn audio_encoder_set_format( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) { Ok(()) => true, Err(err) => { @@ -603,7 +603,7 @@ unsafe extern "C" fn audio_encoder_handle_frame( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame( wrap.unsafe_cast_ref(), Option::::from_glib_none(buffer).as_ref(), @@ -621,7 +621,7 @@ unsafe extern "C" fn audio_encoder_pre_push( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { Ok(Some(new_buffer)) => { *buffer = new_buffer.into_ptr(); @@ -643,7 +643,7 @@ unsafe extern "C" fn audio_encoder_flush(ptr: *mut ffi::Gst let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) }) } @@ -655,7 +655,7 @@ unsafe extern "C" fn audio_encoder_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiate(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -675,7 +675,7 @@ unsafe extern "C" fn audio_encoder_getcaps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { AudioEncoderImpl::caps( imp, wrap.unsafe_cast_ref(), @@ -695,7 +695,7 @@ unsafe extern "C" fn audio_encoder_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -709,7 +709,7 @@ unsafe extern "C" fn audio_encoder_sink_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -723,7 +723,7 @@ unsafe extern "C" fn audio_encoder_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -737,7 +737,7 @@ unsafe extern "C" fn audio_encoder_src_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -752,7 +752,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { @@ -773,7 +773,7 @@ unsafe extern "C" fn audio_encoder_decide_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index 9d0600d7d..8e28459c2 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -207,7 +207,7 @@ unsafe extern "C" fn audiosink_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -224,7 +224,7 @@ unsafe extern "C" fn audiosink_delay(ptr: *mut ffi::GstAudioSi let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), 0, { + gst::panic_to_error!(&wrap, imp.panicked(), 0, { imp.delay(wrap.unsafe_cast_ref()) }) } @@ -236,7 +236,7 @@ unsafe extern "C" fn audiosink_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -258,7 +258,7 @@ unsafe extern "C" fn audiosink_prepare( let spec = &mut *(spec as *mut AudioRingBufferSpec); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { Ok(()) => true, Err(err) => { @@ -277,7 +277,7 @@ unsafe extern "C" fn audiosink_unprepare( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unprepare(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -299,7 +299,7 @@ unsafe extern "C" fn audiosink_write( let wrap: Borrowed = from_glib_borrow(ptr); let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize); - gst::panic_to_error!(&wrap, &imp.panicked(), -1, { + gst::panic_to_error!(&wrap, imp.panicked(), -1, { imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1) }) } @@ -309,7 +309,7 @@ unsafe extern "C" fn audiosink_reset(ptr: *mut ffi::GstAudioSi let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { imp.reset(wrap.unsafe_cast_ref()); }); } diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index c2d1b2d70..dad587cbf 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -223,7 +223,7 @@ unsafe extern "C" fn audiosrc_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -240,7 +240,7 @@ unsafe extern "C" fn audiosrc_delay(ptr: *mut ffi::GstAudioSrc) let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), 0, { + gst::panic_to_error!(&wrap, imp.panicked(), 0, { imp.delay(wrap.unsafe_cast_ref()) }) } @@ -252,7 +252,7 @@ unsafe extern "C" fn audiosrc_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -274,7 +274,7 @@ unsafe extern "C" fn audiosrc_prepare( let spec = &mut *(spec as *mut AudioRingBufferSpec); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { Ok(()) => true, Err(err) => { @@ -293,7 +293,7 @@ unsafe extern "C" fn audiosrc_unprepare( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unprepare(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -316,7 +316,7 @@ unsafe extern "C" fn audiosrc_read( let wrap: Borrowed = from_glib_borrow(ptr); let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize); - gst::panic_to_error!(&wrap, &imp.panicked(), 0, { + gst::panic_to_error!(&wrap, imp.panicked(), 0, { let (res, timestamp_res) = imp .read(wrap.unsafe_cast_ref(), data_slice) .unwrap_or((0, gst::ClockTime::NONE)); @@ -331,7 +331,7 @@ unsafe extern "C" fn audiosrc_reset(ptr: *mut ffi::GstAudioSrc) let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { imp.reset(wrap.unsafe_cast_ref()); }); } diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index 9f64f07e6..98d8369d0 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -249,7 +249,7 @@ impl> AggregatorExtManual for O { { let f: &F = &*(f as *const F); f( - &Aggregator::from_glib_borrow(this).unsafe_cast_ref(), + Aggregator::from_glib_borrow(this).unsafe_cast_ref(), &gst::Segment::from_glib_borrow(segment), from_glib(pts), from_glib(dts), @@ -286,5 +286,5 @@ unsafe extern "C" fn notify_min_upstream_latency_trampoline, { let f: &F = &*(f as *const F); - f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref()) + f(Aggregator::from_glib_borrow(this).unsafe_cast_ref()) } diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 3e2bf9c89..6c13a5e75 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -739,7 +739,7 @@ unsafe extern "C" fn aggregator_flush( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.flush(wrap.unsafe_cast_ref()).into() }) .into_glib() @@ -754,7 +754,7 @@ unsafe extern "C" fn aggregator_clip( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let ret = gst::panic_to_error!(&wrap, &imp.panicked(), None, { + let ret = gst::panic_to_error!(&wrap, imp.panicked(), None, { imp.clip( wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator_pad), @@ -773,7 +773,7 @@ unsafe extern "C" fn aggregator_finish_buffer( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer)) .into() }) @@ -790,7 +790,7 @@ unsafe extern "C" fn aggregator_finish_buffer_list( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list)) .into() }) @@ -806,7 +806,7 @@ unsafe extern "C" fn aggregator_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(wrap, &imp.panicked(), false, { + gst::panic_to_error!(wrap, imp.panicked(), false, { imp.sink_event( wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator_pad), @@ -827,7 +827,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.sink_event_pre_queue( wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator_pad), @@ -847,7 +847,7 @@ unsafe extern "C" fn aggregator_sink_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query( wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator_pad), @@ -868,7 +868,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query_pre_queue( wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator_pad), @@ -886,7 +886,7 @@ unsafe extern "C" fn aggregator_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -900,7 +900,7 @@ unsafe extern "C" fn aggregator_src_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -915,7 +915,7 @@ unsafe extern "C" fn aggregator_src_activate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) { Ok(()) => true, Err(err) => { @@ -935,7 +935,7 @@ unsafe extern "C" fn aggregator_aggregate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout)) .into() }) @@ -949,7 +949,7 @@ unsafe extern "C" fn aggregator_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -968,7 +968,7 @@ unsafe extern "C" fn aggregator_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -987,7 +987,7 @@ unsafe extern "C" fn aggregator_get_next_time( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::ClockTime::NONE, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::ClockTime::NONE, { imp.next_time(wrap.unsafe_cast_ref()) }) .into_glib() @@ -1003,7 +1003,7 @@ unsafe extern "C" fn aggregator_create_new_pad( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { let req_name: Borrowed> = from_glib_borrow(req_name); imp.create_new_pad( @@ -1029,7 +1029,7 @@ unsafe extern "C" fn aggregator_update_src_caps( *res = ptr::null_mut(); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { Ok(res_caps) => { *res = res_caps.into_ptr(); @@ -1049,7 +1049,7 @@ unsafe extern "C" fn aggregator_fixate_src_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps)) }) .into_ptr() @@ -1063,7 +1063,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { Ok(()) => true, Err(err) => { @@ -1084,7 +1084,7 @@ unsafe extern "C" fn aggregator_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.negotiate(wrap.unsafe_cast_ref()) }) .into_glib() @@ -1100,7 +1100,7 @@ unsafe extern "C" fn aggregator_peek_next_sample( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad)) }) .to_glib_full() diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 256cbffe7..123a700db 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -220,7 +220,7 @@ unsafe extern "C" fn base_parse_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -239,7 +239,7 @@ unsafe extern "C" fn base_parse_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -260,7 +260,7 @@ unsafe extern "C" fn base_parse_set_sink_caps( let wrap: Borrowed = from_glib_borrow(ptr); let caps: Borrowed = from_glib_borrow(caps); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) { Ok(()) => true, Err(err) => { @@ -282,8 +282,8 @@ unsafe extern "C" fn base_parse_handle_frame( let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = BaseParseFrame::new(frame, &wrap); - let res = gst::panic_to_error!(&wrap, &imp.panicked(), Err(gst::FlowError::Error), { - imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame) + let res = gst::panic_to_error!(&wrap, imp.panicked(), Err(gst::FlowError::Error), { + imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame) }); match res { @@ -308,7 +308,7 @@ unsafe extern "C" fn base_parse_convert( let wrap: Borrowed = from_glib_borrow(ptr); let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value); - let res = gst::panic_to_error!(&wrap, &imp.panicked(), None, { + let res = gst::panic_to_error!(&wrap, imp.panicked(), None, { imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format)) }); diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index f2fe76762..bb987c223 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -418,7 +418,7 @@ unsafe extern "C" fn base_sink_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -437,7 +437,7 @@ unsafe extern "C" fn base_sink_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -458,7 +458,7 @@ unsafe extern "C" fn base_sink_render( let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.render(wrap.unsafe_cast_ref(), &buffer).into() }) .into_glib() @@ -473,7 +473,7 @@ unsafe extern "C" fn base_sink_prepare( let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.prepare(wrap.unsafe_cast_ref(), &buffer).into() }) .into_glib() @@ -488,7 +488,7 @@ unsafe extern "C" fn base_sink_render_list( let wrap: Borrowed = from_glib_borrow(ptr); let list = from_glib_borrow(list); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.render_list(wrap.unsafe_cast_ref(), &list).into() }) .into_glib() @@ -503,7 +503,7 @@ unsafe extern "C" fn base_sink_prepare_list( let wrap: Borrowed = from_glib_borrow(ptr); let list = from_glib_borrow(list); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.prepare_list(wrap.unsafe_cast_ref(), &list).into() }) .into_glib() @@ -518,7 +518,7 @@ unsafe extern "C" fn base_sink_query( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query) }) .into_glib() @@ -532,7 +532,7 @@ unsafe extern "C" fn base_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr)) }) .into_glib() @@ -547,7 +547,7 @@ unsafe extern "C" fn base_sink_get_caps( let wrap: Borrowed = from_glib_borrow(ptr); let filter = Option::::from_glib_borrow(filter); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) }) .map(|caps| caps.into_ptr()) @@ -563,7 +563,7 @@ unsafe extern "C" fn base_sink_set_caps( let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_borrow(caps); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { Ok(()) => true, Err(err) => { @@ -584,7 +584,7 @@ unsafe extern "C" fn base_sink_fixate( let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_full(caps); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { imp.fixate(wrap.unsafe_cast_ref(), caps) }) .into_ptr() @@ -597,7 +597,7 @@ unsafe extern "C" fn base_sink_unlock( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unlock(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -616,7 +616,7 @@ unsafe extern "C" fn base_sink_unlock_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unlock_stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 046d486da..6c2a23545 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -606,7 +606,7 @@ unsafe extern "C" fn base_src_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -625,7 +625,7 @@ unsafe extern "C" fn base_src_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -644,7 +644,7 @@ unsafe extern "C" fn base_src_is_seekable( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.is_seekable(wrap.unsafe_cast_ref()) }) .into_glib() @@ -658,7 +658,7 @@ unsafe extern "C" fn base_src_get_size( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.size(wrap.unsafe_cast_ref()) { Some(s) => { *size = s; @@ -684,7 +684,7 @@ unsafe extern "C" fn base_src_get_times( *start = gst::ffi::GST_CLOCK_TIME_NONE; *stop = gst::ffi::GST_CLOCK_TIME_NONE; - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer); *start = start_.into_glib(); *stop = stop_.into_glib(); @@ -702,7 +702,7 @@ unsafe extern "C" fn base_src_fill( let wrap: Borrowed = from_glib_borrow(ptr); let buffer = gst::BufferRef::from_mut_ptr(buffer); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer) .into() }) @@ -722,7 +722,7 @@ unsafe extern "C" fn base_src_alloc( // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.alloc(wrap.unsafe_cast_ref(), offset, length) { Ok(buffer) => { *buffer_ptr = buffer.into_ptr(); @@ -753,7 +753,7 @@ unsafe extern "C" fn base_src_create( Some(gst::BufferRef::from_mut_ptr(*buffer_ptr)) }; - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.create( wrap.unsafe_cast_ref(), offset, @@ -828,7 +828,7 @@ unsafe extern "C" fn base_src_do_seek( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { let mut s = from_glib_none(segment); let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s); ptr::write(segment, *(s.to_glib_none().0)); @@ -847,7 +847,7 @@ unsafe extern "C" fn base_src_query( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query) }) .into_glib() @@ -861,7 +861,7 @@ unsafe extern "C" fn base_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr)) }) .into_glib() @@ -876,7 +876,7 @@ unsafe extern "C" fn base_src_get_caps( let wrap: Borrowed = from_glib_borrow(ptr); let filter = Option::::from_glib_borrow(filter); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) }) .map(|caps| caps.into_ptr()) @@ -890,7 +890,7 @@ unsafe extern "C" fn base_src_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiate(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -911,7 +911,7 @@ unsafe extern "C" fn base_src_set_caps( let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_borrow(caps); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { Ok(()) => true, Err(err) => { @@ -932,7 +932,7 @@ unsafe extern "C" fn base_src_fixate( let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_full(caps); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { imp.fixate(wrap.unsafe_cast_ref(), caps) }) .into_ptr() @@ -945,7 +945,7 @@ unsafe extern "C" fn base_src_unlock( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unlock(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -964,7 +964,7 @@ unsafe extern "C" fn base_src_unlock_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unlock_stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 554e579e9..e7a75e3a6 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -891,7 +891,7 @@ unsafe extern "C" fn base_transform_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -910,7 +910,7 @@ unsafe extern "C" fn base_transform_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -932,7 +932,7 @@ unsafe extern "C" fn base_transform_transform_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { let filter: Borrowed> = from_glib_borrow(filter); imp.transform_caps( @@ -956,7 +956,7 @@ unsafe extern "C" fn base_transform_fixate_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { imp.fixate_caps( wrap.unsafe_cast_ref(), from_glib(direction), @@ -976,7 +976,7 @@ unsafe extern "C" fn base_transform_set_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_caps( wrap.unsafe_cast_ref(), &from_glib_borrow(incaps), @@ -1001,7 +1001,7 @@ unsafe extern "C" fn base_transform_accept_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.accept_caps( wrap.unsafe_cast_ref(), from_glib(direction), @@ -1020,7 +1020,7 @@ unsafe extern "C" fn base_transform_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { BaseTransformImpl::query( imp, wrap.unsafe_cast_ref(), @@ -1043,7 +1043,7 @@ unsafe extern "C" fn base_transform_transform_size( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.transform_size( wrap.unsafe_cast_ref(), from_glib(direction), @@ -1070,7 +1070,7 @@ unsafe extern "C" fn base_transform_get_unit_size( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { Some(s) => { *size = s; @@ -1094,7 +1094,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer( // FIXME: Wrong signature in FFI let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer; - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) { Ok(PrepareOutputBufferSuccess::InputBuffer) => { *outbuf = inbuf; @@ -1118,7 +1118,7 @@ unsafe extern "C" fn base_transform_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -1132,7 +1132,7 @@ unsafe extern "C" fn base_transform_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -1147,7 +1147,7 @@ unsafe extern "C" fn base_transform_transform( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.transform( wrap.unsafe_cast_ref(), &from_glib_borrow(inbuf), @@ -1169,7 +1169,7 @@ unsafe extern "C" fn base_transform_transform_ip( // FIXME: Wrong signature in FFI let buf = buf as *mut gst::ffi::GstBuffer; - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) { imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf)) .into() @@ -1193,7 +1193,7 @@ unsafe extern "C" fn base_transform_transform_meta( let inbuf = gst::BufferRef::from_ptr(inbuf); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.transform_meta( wrap.unsafe_cast_ref(), gst::BufferRef::from_mut_ptr(outbuf), @@ -1223,7 +1223,7 @@ unsafe extern "C" fn base_transform_copy_metadata( return glib::ffi::GFALSE; } - gst::panic_to_error!(&wrap, &imp.panicked(), true, { + gst::panic_to_error!(&wrap, imp.panicked(), true, { match imp.copy_metadata( wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf), @@ -1247,7 +1247,7 @@ unsafe extern "C" fn base_transform_before_transform( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)); }) } @@ -1261,7 +1261,7 @@ unsafe extern "C" fn base_transform_submit_input_buffer( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.submit_input_buffer( wrap.unsafe_cast_ref(), from_glib(is_discont), @@ -1282,7 +1282,7 @@ unsafe extern "C" fn base_transform_generate_output( *buf = ptr::null_mut(); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match imp.generate_output(wrap.unsafe_cast_ref()) { Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(), Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok, diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index adf75e343..7e4bb2e35 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -130,7 +130,7 @@ unsafe extern "C" fn push_src_fill( let wrap: Borrowed = from_glib_borrow(ptr); let buffer = gst::BufferRef::from_mut_ptr(buffer); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into() }) .into_glib() @@ -147,7 +147,7 @@ unsafe extern "C" fn push_src_alloc( // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) { Ok(buffer) => { *buffer_ptr = buffer.into_ptr(); @@ -170,7 +170,7 @@ unsafe extern "C" fn push_src_create( // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; - 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()) { Ok(buffer) => { *buffer_ptr = buffer.into_ptr(); diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index 1162c1e48..ed5e28633 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -53,6 +53,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::use_self)] +#[allow(clippy::needless_borrow)] mod auto; pub use crate::auto::*; diff --git a/gstreamer-gl/src/subclass/gl_base_filter.rs b/gstreamer-gl/src/subclass/gl_base_filter.rs index 84e689185..22e0c1071 100644 --- a/gstreamer-gl/src/subclass/gl_base_filter.rs +++ b/gstreamer-gl/src/subclass/gl_base_filter.rs @@ -123,7 +123,7 @@ unsafe extern "C" fn gl_set_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.gl_set_caps( wrap.unsafe_cast_ref(), &from_glib_borrow(incaps), @@ -146,7 +146,7 @@ unsafe extern "C" fn gl_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.gl_start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -163,7 +163,7 @@ unsafe extern "C" fn gl_stop(ptr: *mut GstGLBaseFilter) { let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { imp.gl_stop(wrap.unsafe_cast_ref()) }) } diff --git a/gstreamer-gl/src/subclass/gl_base_src.rs b/gstreamer-gl/src/subclass/gl_base_src.rs index 93b47193c..e70c50dae 100644 --- a/gstreamer-gl/src/subclass/gl_base_src.rs +++ b/gstreamer-gl/src/subclass/gl_base_src.rs @@ -113,7 +113,7 @@ unsafe extern "C" fn gl_start(ptr: *mut GstGLBaseSrc) -> glib: let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.gl_start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -130,7 +130,7 @@ unsafe extern "C" fn gl_stop(ptr: *mut GstGLBaseSrc) { let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), (), { + gst::panic_to_error!(&wrap, imp.panicked(), (), { imp.gl_stop(wrap.unsafe_cast_ref()) }) } @@ -143,7 +143,7 @@ unsafe extern "C" fn fill_gl_memory( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.fill_gl_memory(wrap.unsafe_cast_ref(), &from_glib_borrow(memory)) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index c292de2d0..e47bbf186 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -262,7 +262,7 @@ unsafe extern "C" fn filter( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.filter( wrap.unsafe_cast_ref(), &from_glib_borrow(input), @@ -287,7 +287,7 @@ unsafe extern "C" fn filter_texture( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.filter_texture( wrap.unsafe_cast_ref(), &from_glib_borrow(input), @@ -308,7 +308,7 @@ unsafe extern "C" fn init_fbo(ptr: *mut GstGLFilter) -> glib::f let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.init_fbo(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -329,7 +329,7 @@ unsafe extern "C" fn set_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match GLFilterImpl::set_caps( imp, wrap.unsafe_cast_ref(), @@ -356,7 +356,7 @@ unsafe extern "C" fn transform_internal_caps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), None, { + gst::panic_to_error!(&wrap, imp.panicked(), None, { let filter_caps: Borrowed> = from_glib_borrow(filter_caps); imp.transform_internal_caps( diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index 293125e67..5ba93d99c 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -61,5 +61,5 @@ unsafe extern "C" fn notify_timeout_trampoline, { let f: &F = &*(f as *const F); - f(&Discoverer::from_glib_borrow(this).unsafe_cast_ref()) + f(Discoverer::from_glib_borrow(this).unsafe_cast_ref()) } diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index 9185e52ca..c10972001 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -92,7 +92,7 @@ where { let f: &F = &*(f as *const F); match f( - &RTSPAuth::from_glib_borrow(this).unsafe_cast_ref(), + RTSPAuth::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(connection), &from_glib_borrow(peer_cert), from_glib(errors), diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index a221a0521..b65589b23 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::use_self)] +#[allow(clippy::needless_borrow)] mod auto; pub use crate::auto::*; diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index 3f0111ff3..adec2f798 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -562,7 +562,7 @@ unsafe extern "C" fn video_decoder_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -581,7 +581,7 @@ unsafe extern "C" fn video_decoder_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -600,7 +600,7 @@ unsafe extern "C" fn video_decoder_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -619,7 +619,7 @@ unsafe extern "C" fn video_decoder_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -638,7 +638,7 @@ unsafe extern "C" fn video_decoder_finish( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.finish(wrap.unsafe_cast_ref()).into() }) .into_glib() @@ -651,7 +651,7 @@ unsafe extern "C" fn video_decoder_drain( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.drain(wrap.unsafe_cast_ref()).into() }) .into_glib() @@ -667,7 +667,7 @@ unsafe extern "C" fn video_decoder_set_format( ffi::gst_video_codec_state_ref(state); let wrap_state = VideoCodecState::::new(state); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { Ok(()) => true, Err(err) => { @@ -693,7 +693,7 @@ unsafe extern "C" fn video_decoder_parse( let wrap_adapter: Borrowed = from_glib_borrow(adapter); let at_eos: bool = from_glib(at_eos); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos) .into() }) @@ -709,7 +709,7 @@ unsafe extern "C" fn video_decoder_handle_frame( let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = VideoCodecFrame::new(frame, &*wrap); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() }) .into_glib() @@ -722,7 +722,7 @@ unsafe extern "C" fn video_decoder_flush( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref()) }) .into_glib() @@ -735,7 +735,7 @@ unsafe extern "C" fn video_decoder_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiate(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -755,7 +755,7 @@ unsafe extern "C" fn video_decoder_getcaps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { VideoDecoderImpl::caps( imp, wrap.unsafe_cast_ref(), @@ -775,7 +775,7 @@ unsafe extern "C" fn video_decoder_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -789,7 +789,7 @@ unsafe extern "C" fn video_decoder_sink_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -803,7 +803,7 @@ unsafe extern "C" fn video_decoder_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -817,7 +817,7 @@ unsafe extern "C" fn video_decoder_src_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -832,7 +832,7 @@ unsafe extern "C" fn video_decoder_propose_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { @@ -853,7 +853,7 @@ unsafe extern "C" fn video_decoder_decide_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 1a336113e..e919fc46f 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -496,7 +496,7 @@ unsafe extern "C" fn video_encoder_open( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.open(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -515,7 +515,7 @@ unsafe extern "C" fn video_encoder_close( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.close(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -534,7 +534,7 @@ unsafe extern "C" fn video_encoder_start( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.start(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -553,7 +553,7 @@ unsafe extern "C" fn video_encoder_stop( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.stop(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -572,7 +572,7 @@ unsafe extern "C" fn video_encoder_finish( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.finish(wrap.unsafe_cast_ref()).into() }) .into_glib() @@ -588,7 +588,7 @@ unsafe extern "C" fn video_encoder_set_format( ffi::gst_video_codec_state_ref(state); let wrap_state = VideoCodecState::::new(state); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { Ok(()) => true, Err(err) => { @@ -609,7 +609,7 @@ unsafe extern "C" fn video_encoder_handle_frame( let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = VideoCodecFrame::new(frame, &*wrap); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() }) .into_glib() @@ -622,7 +622,7 @@ unsafe extern "C" fn video_encoder_flush( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) }) .into_glib() @@ -635,7 +635,7 @@ unsafe extern "C" fn video_encoder_negotiate( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.negotiate(wrap.unsafe_cast_ref()) { Ok(()) => true, Err(err) => { @@ -655,7 +655,7 @@ unsafe extern "C" fn video_encoder_getcaps( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { + gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), { VideoEncoderImpl::caps( imp, wrap.unsafe_cast_ref(), @@ -675,7 +675,7 @@ unsafe extern "C" fn video_encoder_sink_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -689,7 +689,7 @@ unsafe extern "C" fn video_encoder_sink_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -703,7 +703,7 @@ unsafe extern "C" fn video_encoder_src_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -717,7 +717,7 @@ unsafe extern "C" fn video_encoder_src_query( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) .into_glib() @@ -732,7 +732,7 @@ unsafe extern "C" fn video_encoder_propose_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { @@ -753,7 +753,7 @@ unsafe extern "C" fn video_encoder_decide_allocation( let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { Ok(()) => true, Err(err) => { diff --git a/gstreamer-video/src/subclass/video_filter.rs b/gstreamer-video/src/subclass/video_filter.rs index de73c4920..c80bb8ca0 100644 --- a/gstreamer-video/src/subclass/video_filter.rs +++ b/gstreamer-video/src/subclass/video_filter.rs @@ -247,7 +247,7 @@ unsafe extern "C" fn video_filter_set_info( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), false, { + gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.set_info( wrap.unsafe_cast_ref(), &from_glib_borrow(incaps), @@ -274,7 +274,7 @@ unsafe extern "C" fn video_filter_transform_frame( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.transform_frame( wrap.unsafe_cast_ref(), &VideoFrameRef::from_glib_borrow(inframe), @@ -293,7 +293,7 @@ unsafe extern "C" fn video_filter_transform_frame_ip( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { if from_glib(gst_base::ffi::gst_base_transform_is_passthrough( ptr as *mut gst_base::ffi::GstBaseTransform, )) { diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index c7c19eec2..0419df697 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -68,7 +68,7 @@ unsafe extern "C" fn video_sink_show_frame( let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); - gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { + gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, { imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into() }) .into_glib() diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index a1696cb69..5ba2cdc91 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -328,9 +328,9 @@ impl Ord for VideoFormatInfo { fn cmp(&self, other: &Self) -> Ordering { self.n_components() .cmp(&other.n_components()) - .then_with(|| self.depth().cmp(&other.depth())) - .then_with(|| self.w_sub().cmp(&other.w_sub()).reverse()) - .then_with(|| self.h_sub().cmp(&other.h_sub()).reverse()) + .then_with(|| self.depth().cmp(other.depth())) + .then_with(|| self.w_sub().cmp(other.w_sub()).reverse()) + .then_with(|| self.h_sub().cmp(other.h_sub()).reverse()) .then_with(|| self.n_planes().cmp(&other.n_planes())) .then_with(|| { // Format using native endianess is considered as bigger @@ -363,8 +363,8 @@ impl Ord for VideoFormatInfo { _ => Ordering::Equal, } }) - .then_with(|| self.pixel_stride().cmp(&other.pixel_stride())) - .then_with(|| self.poffset().cmp(&other.poffset())) + .then_with(|| self.pixel_stride().cmp(other.pixel_stride())) + .then_with(|| self.poffset().cmp(other.poffset())) .then_with(|| { // Prefer non-complex formats match ( @@ -401,7 +401,7 @@ impl Ord for VideoFormatInfo { }) .then_with(|| { // tie, sort by name - self.name().cmp(&other.name()) + self.name().cmp(other.name()) }) } } diff --git a/gstreamer-webrtc/src/lib.rs b/gstreamer-webrtc/src/lib.rs index 5711d809d..ffda903f9 100644 --- a/gstreamer-webrtc/src/lib.rs +++ b/gstreamer-webrtc/src/lib.rs @@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::use_self)] +#[allow(clippy::needless_borrow)] mod auto; pub use crate::auto::*; diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 87e17df7a..8c1d84289 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -218,7 +218,7 @@ where P: IsA, { let f: &F = &*(f as *const F); - match f(&Bin::from_glib_borrow(this).unsafe_cast_ref()) { + match f(Bin::from_glib_borrow(this).unsafe_cast_ref()) { Ok(()) => true, Err(err) => { err.log_with_object(&*Bin::from_glib_borrow(this)); diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index c3a7a2c3a..d64fa6ebe 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -743,7 +743,7 @@ impl> ElementExtManual for O { let user_data: &mut Option = &mut *(user_data as *mut _); let callback = user_data.take().unwrap(); - callback(&Element::from_glib_borrow(element).unsafe_cast_ref()); + callback(Element::from_glib_borrow(element).unsafe_cast_ref()); } unsafe extern "C" fn free_user_data, F: FnOnce(&O) + Send + 'static>( diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 2999e09d8..c7bba9257 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -27,6 +27,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] #[allow(clippy::use_self)] +#[allow(clippy::needless_borrow)] mod auto; pub use crate::auto::functions::*; pub use crate::auto::*; diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index f3284e2de..59a6f239c 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -1157,7 +1157,7 @@ where let (mut probe_info, data_type) = create_probe_info(info); let ret = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), &mut probe_info, ); @@ -1179,7 +1179,7 @@ where let func: &F = &*((*pad).activatedata as *const F); match func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1211,7 +1211,7 @@ where let func: &F = &*((*pad).activatemodedata as *const F); match func( - &&Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1244,7 +1244,7 @@ where let func: &F = &*((*pad).chaindata as *const F); let res: FlowReturn = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1271,7 +1271,7 @@ where let func: &F = &*((*pad).chainlistdata as *const F); let res: FlowReturn = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1295,7 +1295,7 @@ where let func: &F = &*((*pad).eventdata as *const F); func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1321,7 +1321,7 @@ where let func: &F = &*((*pad).eventdata as *const F); let res: FlowReturn = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1366,7 +1366,7 @@ where }; match func( - &pad, + pad, Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1440,7 +1440,7 @@ where // Steal the iterator and return it let ret = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1470,7 +1470,7 @@ where let func: &F = &*((*pad).linkdata as *const F); let res: crate::PadLinkReturn = func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1494,7 +1494,7 @@ where let func: &F = &*((*pad).querydata as *const F); func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), @@ -1515,7 +1515,7 @@ unsafe extern "C" fn trampoline_unlink_function< let func: &F = &*((*pad).unlinkdata as *const F); func( - &Pad::from_glib_borrow(pad).unsafe_cast_ref(), + Pad::from_glib_borrow(pad).unsafe_cast_ref(), Option::::from_glib_borrow(parent) .as_ref() .as_ref(), diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 9ad489477..51680523f 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -941,7 +941,7 @@ mod tests { let a = "Test, f1=(string)abc, f2=(uint)123;"; - let s = Structure::from_str(&a).unwrap(); + let s = Structure::from_str(a).unwrap(); assert_eq!(s.get::<&str>("f1"), Ok("abc")); assert_eq!(s.get::("f2"), Ok(123)); @@ -956,7 +956,7 @@ mod tests { let a = None::<&Structure>.to_value(); assert!(a.get::>().unwrap().is_none()); - let b = Structure::from_str(&"foo").unwrap().to_value(); + let b = Structure::from_str("foo").unwrap().to_value(); assert!(b.get::>().unwrap().is_some()); } diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 1cf550aef..c2463d5d2 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -120,7 +120,7 @@ unsafe extern "C" fn bin_add_element( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - panic_to_error!(&wrap, &imp.panicked(), false, { + panic_to_error!(&wrap, imp.panicked(), false, { match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { Ok(()) => true, Err(err) => { @@ -149,7 +149,7 @@ unsafe extern "C" fn bin_remove_element( return glib::ffi::GFALSE; } - panic_to_error!(&wrap, &imp.panicked(), false, { + panic_to_error!(&wrap, imp.panicked(), false, { match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { Ok(()) => true, Err(err) => { @@ -169,7 +169,7 @@ unsafe extern "C" fn bin_handle_message( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - panic_to_error!(&wrap, &imp.panicked(), (), { + panic_to_error!(&wrap, imp.panicked(), (), { imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message)) }); } diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index 684accee7..969052286 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -135,7 +135,7 @@ unsafe extern "C" fn child_proxy_get_child_by_name( let imp = instance.impl_(); imp.child_by_name( - &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), + from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), &glib::GString::from_glib_borrow(name), ) .to_glib_full() @@ -149,7 +149,7 @@ unsafe extern "C" fn child_proxy_get_child_by_index( let imp = instance.impl_(); imp.child_by_index( - &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), + from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), index, ) .to_glib_full() @@ -161,7 +161,7 @@ unsafe extern "C" fn child_proxy_get_children_count( let instance = &*(child_proxy as *mut T::Instance); let imp = instance.impl_(); - imp.children_count(&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref()) + imp.children_count(from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref()) } unsafe extern "C" fn child_proxy_child_added( @@ -173,7 +173,7 @@ unsafe extern "C" fn child_proxy_child_added( let imp = instance.impl_(); imp.child_added( - &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), + from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), &from_glib_borrow(child), &glib::GString::from_glib_borrow(name), ) @@ -188,7 +188,7 @@ unsafe extern "C" fn child_proxy_child_removed( let imp = instance.impl_(); imp.child_removed( - &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), + from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), &from_glib_borrow(child), &glib::GString::from_glib_borrow(name), ) diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 64c92a251..44f79007b 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -332,7 +332,7 @@ impl ElementImplExt for T { let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); - panic_to_error!(element, &imp.panicked(), fallback(), { f(&imp) }) + panic_to_error!(element, imp.panicked(), fallback(), { f(imp) }) } } @@ -348,8 +348,8 @@ impl ElementImplExt for T { let instance = &*(ptr as *mut Self::Instance); let imp = instance.impl_(); - panic_to_error!(wrap, &imp.panicked(), fallback(), { - f(&imp, wrap.unsafe_cast_ref()) + panic_to_error!(wrap, imp.panicked(), fallback(), { + f(imp, wrap.unsafe_cast_ref()) }) } } @@ -420,7 +420,7 @@ unsafe extern "C" fn element_change_state( _ => StateChangeReturn::Failure, }; - panic_to_error!(&wrap, &imp.panicked(), fallback, { + panic_to_error!(&wrap, imp.panicked(), fallback, { imp.change_state(wrap.unsafe_cast_ref(), transition).into() }) .into_glib() @@ -440,7 +440,7 @@ unsafe extern "C" fn element_request_new_pad( // XXX: This is effectively unsafe but the best we can do // See https://bugzilla.gnome.org/show_bug.cgi?id=791193 - let pad = panic_to_error!(&wrap, &imp.panicked(), None, { + let pad = panic_to_error!(&wrap, imp.panicked(), None, { imp.request_new_pad( wrap.unsafe_cast_ref(), &from_glib_borrow(templ), @@ -478,7 +478,7 @@ unsafe extern "C" fn element_release_pad( return; } - panic_to_error!(&wrap, &imp.panicked(), (), { + panic_to_error!(&wrap, imp.panicked(), (), { imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad)) }) } @@ -491,7 +491,7 @@ unsafe extern "C" fn element_send_event( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - panic_to_error!(&wrap, &imp.panicked(), false, { + panic_to_error!(&wrap, imp.panicked(), false, { imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) .into_glib() @@ -506,7 +506,7 @@ unsafe extern "C" fn element_query( let wrap: Borrowed = from_glib_borrow(ptr); let query = QueryRef::from_mut_ptr(query); - panic_to_error!(&wrap, &imp.panicked(), false, { + panic_to_error!(&wrap, imp.panicked(), false, { imp.query(wrap.unsafe_cast_ref(), query) }) .into_glib() @@ -520,7 +520,7 @@ unsafe extern "C" fn element_set_context( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - panic_to_error!(&wrap, &imp.panicked(), (), { + panic_to_error!(&wrap, imp.panicked(), (), { imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context)) }) } @@ -535,7 +535,7 @@ unsafe extern "C" fn element_set_clock( let clock = Option::::from_glib_borrow(clock); - panic_to_error!(&wrap, &imp.panicked(), false, { + panic_to_error!(&wrap, imp.panicked(), false, { imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref()) }) .into_glib() @@ -548,7 +548,7 @@ unsafe extern "C" fn element_provide_clock( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - panic_to_error!(&wrap, &imp.panicked(), None, { + panic_to_error!(&wrap, imp.panicked(), None, { imp.provide_clock(wrap.unsafe_cast_ref()) }) .to_glib_full() @@ -790,9 +790,9 @@ mod tests { src.set_property("num-buffers", &100i32).unwrap(); pipeline - .add_many(&[&src, &element.upcast_ref(), &sink]) + .add_many(&[&src, element.upcast_ref(), &sink]) .unwrap(); - Element::link_many(&[&src, &element.upcast_ref(), &sink]).unwrap(); + Element::link_many(&[&src, element.upcast_ref(), &sink]).unwrap(); pipeline.set_state(crate::State::Playing).unwrap(); let bus = pipeline.bus().unwrap(); diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index d4df1cdac..c17656f06 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -128,7 +128,7 @@ unsafe extern "C" fn uri_handler_get_uri( let instance = &*(uri_handler as *mut T::Instance); let imp = instance.impl_(); - imp.uri(&from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref()) + imp.uri(from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref()) .to_glib_full() } @@ -141,7 +141,7 @@ unsafe extern "C" fn uri_handler_set_uri( let imp = instance.impl_(); match imp.set_uri( - &from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref(), + from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref(), glib::GString::from_glib_borrow(uri).as_str(), ) { Ok(()) => true.into_glib(),