Skip to content

Commit

Permalink
Fix/silence a few more clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege committed Jun 6, 2023
1 parent 01f0197 commit 840a2eb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion glib/src/collections/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ impl<T: TransparentPtrType> List<T> {
/// 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())
}
Expand Down
3 changes: 2 additions & 1 deletion glib/src/collections/slist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ impl<T: TransparentPtrType> SList<T> {
/// 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())
}
Expand Down
3 changes: 1 addition & 2 deletions glib/src/main_context_futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,10 @@ impl MainContext {
pub fn block_on<F: Future>(&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 {
Expand Down
2 changes: 1 addition & 1 deletion glib/src/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@ impl<A: AsRef<[T]>, T: FixedSizeVariantType> From<FixedSizeVariantArray<A, T>> f
let data = Box::new(a.0);
let (data_ptr, len) = {
let data = (*data).as_ref();
(data.as_ptr(), data.len() * mem::size_of::<T>())
(data.as_ptr(), mem::size_of_val(data))
};

unsafe extern "C" fn free_data<A: AsRef<[T]>, T: FixedSizeVariantType>(
Expand Down
2 changes: 2 additions & 0 deletions pangocairo/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down

0 comments on commit 840a2eb

Please sign in to comment.