diff --git a/glib/src/collections/list.rs b/glib/src/collections/list.rs index aa6a24ed1183..71bf92b3e933 100644 --- a/glib/src/collections/list.rs +++ b/glib/src/collections/list.rs @@ -385,7 +385,8 @@ impl List { /// Consumes the list and returns the underlying pointer. #[inline] pub fn into_raw(mut self) -> *mut ffi::GList { - mem::replace(&mut self.ptr, None) + self.ptr + .take() .map(|p| p.as_ptr()) .unwrap_or(ptr::null_mut()) } diff --git a/glib/src/collections/slist.rs b/glib/src/collections/slist.rs index 2aa03f97b07b..70f013b202cd 100644 --- a/glib/src/collections/slist.rs +++ b/glib/src/collections/slist.rs @@ -380,7 +380,8 @@ impl SList { /// Consumes the list and returns the underlying pointer. #[inline] pub fn into_raw(mut self) -> *mut ffi::GSList { - mem::replace(&mut self.ptr, None) + self.ptr + .take() .map(|p| p.as_ptr()) .unwrap_or(ptr::null_mut()) } diff --git a/glib/src/main_context_futures.rs b/glib/src/main_context_futures.rs index a86f89d145bc..5e0f86e5ff87 100644 --- a/glib/src/main_context_futures.rs +++ b/glib/src/main_context_futures.rs @@ -620,11 +620,10 @@ impl MainContext { pub fn block_on(&self, f: F) -> F::Output { let mut res = None; let l = MainLoop::new(Some(self), false); - let l_clone = l.clone(); let f = async { res = Some(panic::AssertUnwindSafe(f).catch_unwind().await); - l_clone.quit(); + l.quit(); }; let f = unsafe { diff --git a/glib/src/variant.rs b/glib/src/variant.rs index 59163e810d1b..7793e804d23b 100644 --- a/glib/src/variant.rs +++ b/glib/src/variant.rs @@ -1958,7 +1958,7 @@ impl, T: FixedSizeVariantType> From> f let data = Box::new(a.0); let (data_ptr, len) = { let data = (*data).as_ref(); - (data.as_ptr(), data.len() * mem::size_of::()) + (data.as_ptr(), mem::size_of_val(data)) }; unsafe extern "C" fn free_data, T: FixedSizeVariantType>( diff --git a/pangocairo/src/prelude.rs b/pangocairo/src/prelude.rs index 3992832392b4..80249c607629 100644 --- a/pangocairo/src/prelude.rs +++ b/pangocairo/src/prelude.rs @@ -1,5 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. +#![allow(ambiguous_glob_reexports)] + #[doc(hidden)] pub use glib::prelude::*; #[doc(hidden)]