Fix a new beta clippy warning

warning: unused return value of `std::boxed::Box::<T>::from_raw` that must be used
  --> gstreamer-rtsp-server/src/rtsp_session_pool.rs:23:5
   |
23 |     Box::<F>::from_raw(ptr as *mut _);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: call `drop(from_raw(ptr))` if you intend to drop the `Box`
This commit is contained in:
Sebastian Dröge 2022-08-10 12:27:00 +03:00 committed by Sebastian Dröge
parent 583ef0395d
commit b06a692dea
7 changed files with 11 additions and 11 deletions

View file

@ -264,7 +264,7 @@ unsafe extern "C" fn trampoline_new_event(
} }
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
Box::<AppSinkCallbacks>::from_raw(ptr as *mut _); let _ = Box::<AppSinkCallbacks>::from_raw(ptr as *mut _);
} }
impl AppSink { impl AppSink {

View file

@ -201,7 +201,7 @@ unsafe extern "C" fn trampoline_seek_data(
} }
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
Box::<AppSrcCallbacks>::from_raw(ptr as *mut _); let _ = Box::<AppSrcCallbacks>::from_raw(ptr as *mut _);
} }
impl AppSrc { impl AppSrc {

View file

@ -20,7 +20,7 @@ unsafe extern "C" fn destroy_closure_watch<
>( >(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func: F) -> gpointer { fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func: F) -> gpointer {

View file

@ -31,7 +31,7 @@ unsafe extern "C" fn destroy_closure_watch<
>( >(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
fn into_raw_watch<F: FnMut(&Bus, &Message) -> Continue + Send + 'static>(func: F) -> gpointer { fn into_raw_watch<F: FnMut(&Bus, &Message) -> Continue + Send + 'static>(func: F) -> gpointer {
@ -53,7 +53,7 @@ unsafe extern "C" fn trampoline_watch_local<F: FnMut(&Bus, &Message) -> Continue
unsafe extern "C" fn destroy_closure_watch_local<F: FnMut(&Bus, &Message) -> Continue + 'static>( unsafe extern "C" fn destroy_closure_watch_local<F: FnMut(&Bus, &Message) -> Continue + 'static>(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<glib::thread_guard::ThreadGuard<F>>::from_raw(ptr as *mut _); let _ = Box::<glib::thread_guard::ThreadGuard<F>>::from_raw(ptr as *mut _);
} }
fn into_raw_watch_local<F: FnMut(&Bus, &Message) -> Continue + 'static>(func: F) -> gpointer { fn into_raw_watch_local<F: FnMut(&Bus, &Message) -> Continue + 'static>(func: F) -> gpointer {
@ -85,7 +85,7 @@ unsafe extern "C" fn destroy_closure_sync<
>( >(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
fn into_raw_sync<F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static>( fn into_raw_sync<F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static>(

View file

@ -169,7 +169,7 @@ impl SingleShotClockId {
>( >(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<Option<F>>::from_raw(ptr as *mut _); let _ = Box::<Option<F>>::from_raw(ptr as *mut _);
} }
let func: Box<Option<F>> = Box::new(Some(func)); let func: Box<Option<F>> = Box::new(Some(func));
@ -286,7 +286,7 @@ impl PeriodicClockId {
>( >(
ptr: gpointer, ptr: gpointer,
) { ) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
let func: Box<F> = Box::new(func); let func: Box<F> = Box::new(func);

View file

@ -1592,7 +1592,7 @@ unsafe extern "C" fn trampoline_unlink_function<
} }
unsafe extern "C" fn destroy_closure<F>(ptr: gpointer) { unsafe extern "C" fn destroy_closure<F>(ptr: gpointer) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
unsafe extern "C" fn trampoline_pad_task<F: FnMut() + Send + 'static>(func: gpointer) { unsafe extern "C" fn trampoline_pad_task<F: FnMut() + Send + 'static>(func: gpointer) {
@ -1607,7 +1607,7 @@ fn into_raw_pad_task<F: FnMut() + Send + 'static>(func: F) -> gpointer {
} }
unsafe extern "C" fn destroy_closure_pad_task<F>(ptr: gpointer) { unsafe extern "C" fn destroy_closure_pad_task<F>(ptr: gpointer) {
Box::<F>::from_raw(ptr as *mut _); let _ = Box::<F>::from_raw(ptr as *mut _);
} }
impl Pad { impl Pad {

View file

@ -125,7 +125,7 @@ unsafe extern "C" fn type_find_trampoline<F: Fn(&mut TypeFind) + Send + Sync + '
unsafe extern "C" fn type_find_closure_drop<F: Fn(&mut TypeFind) + Send + Sync + 'static>( unsafe extern "C" fn type_find_closure_drop<F: Fn(&mut TypeFind) + Send + Sync + 'static>(
data: glib::ffi::gpointer, data: glib::ffi::gpointer,
) { ) {
Box::<F>::from_raw(data as *mut _); let _ = Box::<F>::from_raw(data as *mut _);
} }
unsafe extern "C" fn type_find_peek( unsafe extern "C" fn type_find_peek(