Skip to content

Commit

Permalink
Fix nightly clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Aug 27, 2023
1 parent 813f6db commit 5935630
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cairo/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Region {

#[doc(alias = "get_extents")]
#[doc(alias = "cairo_region_get_extents")]
pub fn extents(&self, rectangle: &mut RectangleInt) {
pub fn extents(&self, rectangle: &RectangleInt) {
unsafe { ffi::cairo_region_get_extents(self.0.as_ptr(), rectangle.to_raw_none()) }
}

Expand Down
1 change: 0 additions & 1 deletion gio/src/file_descriptor_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use glib::{prelude::*, translate::*};
#[cfg(all(not(unix), docsrs))]
use socket::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use std::fmt;

glib::wrapper! {
#[doc(alias = "GFileDescriptorBased")]
Expand Down
2 changes: 1 addition & 1 deletion gio/src/io_extension_point.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::{fmt, marker::PhantomData, ptr};
use std::{marker::PhantomData, ptr};

use glib::{translate::*, GString, IntoGStr, Type};

Expand Down
2 changes: 0 additions & 2 deletions gio/src/socket_msg_flags.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::fmt;

use glib::{bitflags, prelude::*, translate::*, value::FromValue, Type};

bitflags::bitflags! {
Expand Down
2 changes: 1 addition & 1 deletion gio/src/unix_mount_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl Eq for UnixMountEntry {}
impl PartialOrd for UnixMountEntry {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.compare(other).partial_cmp(&0)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ impl<T: 'static, MM: BoxedMemoryManager<Target = T>> fmt::Debug for Boxed<T, MM>
impl<T, MM: BoxedMemoryManager<Target = T>> PartialOrd for Boxed<T, MM> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.to_glib_none().0.partial_cmp(&other.to_glib_none().0)
Some(self.cmp(other))
}
}

Expand Down
8 changes: 1 addition & 7 deletions glib/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,7 @@ impl Eq for Bytes {}
impl PartialOrd for Bytes {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
unsafe {
let ret = ffi::g_bytes_compare(
ToGlibPtr::<*const _>::to_glib_none(self).0 as *const _,
ToGlibPtr::<*const _>::to_glib_none(other).0 as *const _,
);
ret.partial_cmp(&0)
}
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/collections/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ pub struct IterMut<'a, T: TransparentPtrType> {

impl<'a, T: TransparentPtrType> IterMut<'a, T> {
#[inline]
fn new(list: &'a mut List<T>) -> IterMut<'a, T> {
fn new(list: &'a List<T>) -> IterMut<'a, T> {
debug_assert_eq!(
mem::size_of::<T>(),
mem::size_of::<<T as GlibPtrDefault>::GlibType>()
Expand Down
2 changes: 1 addition & 1 deletion glib/src/collections/slist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ pub struct IterMut<'a, T: TransparentPtrType> {

impl<'a, T: TransparentPtrType> IterMut<'a, T> {
#[inline]
fn new(list: &'a mut SList<T>) -> IterMut<'a, T> {
fn new(list: &'a SList<T>) -> IterMut<'a, T> {
debug_assert_eq!(
mem::size_of::<T>(),
mem::size_of::<<T as GlibPtrDefault>::GlibType>()
Expand Down
2 changes: 1 addition & 1 deletion glib/src/collections/strv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Eq for StrV {}
impl PartialOrd for StrV {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.as_slice().partial_cmp(other.as_slice())
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ impl Eq for Date {}
impl PartialOrd for Date {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.compare(other).partial_cmp(&0)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl Eq for EnumValue {}

impl PartialOrd for EnumValue {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.value().partial_cmp(&other.value())
Some(self.cmp(other))
}
}

Expand Down
6 changes: 3 additions & 3 deletions glib/src/gstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ impl Eq for GStr {}
impl PartialOrd for GStr {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.as_str().partial_cmp(other.as_str())
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -849,7 +849,7 @@ impl PartialEq<GStringPtr> for GStr {
impl PartialOrd<GStringPtr> for GStringPtr {
#[inline]
fn partial_cmp(&self, other: &GStringPtr) -> Option<std::cmp::Ordering> {
Some(unsafe { GStringPtr::strcmp(self.as_ptr(), other.as_ptr()) })
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -1223,7 +1223,7 @@ impl GString {
pub fn as_gstr(&self) -> &GStr {
let bytes = match self.0 {
Inner::Native(ref s) => s.as_bytes(),
Inner::Foreign { len, .. } if len == 0 => &[0],
Inner::Foreign { len: 0, .. } => &[0],
Inner::Foreign { ptr, len } => unsafe {
slice::from_raw_parts(ptr.as_ptr() as *const _, len + 1)
},
Expand Down
4 changes: 2 additions & 2 deletions glib/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl fmt::Debug for ObjectRef {
impl PartialOrd for ObjectRef {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.inner.partial_cmp(&other.inner)
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -579,7 +579,7 @@ impl<T, P> fmt::Debug for TypedObjectRef<T, P> {
impl<T, P> PartialOrd for TypedObjectRef<T, P> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.inner.partial_cmp(&other.inner)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ impl<T, MM: SharedMemoryManager<Target = T>> fmt::Debug for Shared<T, MM> {
impl<T, MM: SharedMemoryManager<Target = T>> PartialOrd for Shared<T, MM> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.inner.partial_cmp(&other.inner)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/subclass/object_impl_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<T: ObjectSubclass> Downgrade for ObjectImplRef<T> {
impl<T: ObjectSubclass> PartialOrd for ObjectImplRef<T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit 5935630

Please sign in to comment.