Skip to content

Commit

Permalink
Fix new beta clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Oct 31, 2024
1 parent fc2917d commit b242ce7
Show file tree
Hide file tree
Showing 30 changed files with 125 additions and 127 deletions.
2 changes: 1 addition & 1 deletion cairo/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{Content, RecordingSurface, ScriptMode, Surface};
#[must_use = "if unused the Device will immediately be released"]
pub struct DeviceAcquireGuard<'a>(&'a Device);

impl<'a> Drop for DeviceAcquireGuard<'a> {
impl Drop for DeviceAcquireGuard<'_> {
#[inline]
fn drop(&mut self) {
self.0.release();
Expand Down
10 changes: 5 additions & 5 deletions cairo/src/image_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ pub struct ImageSurfaceData<'a> {
dirty: bool,
}

unsafe impl<'a> Send for ImageSurfaceData<'a> {}
unsafe impl<'a> Sync for ImageSurfaceData<'a> {}
unsafe impl Send for ImageSurfaceData<'_> {}
unsafe impl Sync for ImageSurfaceData<'_> {}

impl<'a> ImageSurfaceData<'a> {
fn new(surface: &'a mut ImageSurface) -> ImageSurfaceData<'a> {
Expand All @@ -255,7 +255,7 @@ impl<'a> ImageSurfaceData<'a> {
}
}

impl<'a> Drop for ImageSurfaceData<'a> {
impl Drop for ImageSurfaceData<'_> {
#[inline]
fn drop(&mut self) {
if self.dirty {
Expand All @@ -264,7 +264,7 @@ impl<'a> Drop for ImageSurfaceData<'a> {
}
}

impl<'a> Deref for ImageSurfaceData<'a> {
impl Deref for ImageSurfaceData<'_> {
type Target = [u8];

#[inline]
Expand All @@ -273,7 +273,7 @@ impl<'a> Deref for ImageSurfaceData<'a> {
}
}

impl<'a> DerefMut for ImageSurfaceData<'a> {
impl DerefMut for ImageSurfaceData<'_> {
#[inline]
fn deref_mut(&mut self) -> &mut [u8] {
self.dirty = true;
Expand Down
4 changes: 2 additions & 2 deletions cairo/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct PathSegments<'a> {
num_data: usize,
}

impl<'a> Iterator for PathSegments<'a> {
impl Iterator for PathSegments<'_> {
type Item = PathSegment;

fn next(&mut self) -> Option<PathSegment> {
Expand Down Expand Up @@ -93,7 +93,7 @@ impl<'a> Iterator for PathSegments<'a> {
}
}

impl<'a> FusedIterator for PathSegments<'a> {}
impl FusedIterator for PathSegments<'_> {}

fn to_tuple(pair: &[f64; 2]) -> (f64, f64) {
(pair[0], pair[1])
Expand Down
2 changes: 1 addition & 1 deletion gio/src/dbus_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct RegistrationBuilder<'a> {
Option<Box_<dyn Fn(DBusConnection, &str, &str, &str, &str, glib::Variant) -> bool>>,
}

impl<'a> RegistrationBuilder<'a> {
impl RegistrationBuilder<'_> {
pub fn method_call<
F: Fn(DBusConnection, &str, &str, &str, &str, glib::Variant, DBusMethodInvocation) + 'static,
>(
Expand Down
2 changes: 1 addition & 1 deletion gio/src/inet_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum InetAddressBytes<'a> {
V6(&'a [u8; 16]),
}

impl<'a> InetAddressBytes<'a> {
impl InetAddressBytes<'_> {
#[inline]
fn deref(&self) -> &[u8] {
use self::InetAddressBytes::*;
Expand Down
11 changes: 5 additions & 6 deletions gio/src/list_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub trait ListModelExtManual: IsA<ListModel> + Sized {
/// # Panics
///
/// Panics if `T::static_type().is_a(self.item_type())` is not true.

fn iter<LT: IsA<glib::Object>>(&self) -> ListModelIter<LT> {
assert!(self.item_type().is_a(LT::static_type()));

Expand Down Expand Up @@ -80,7 +79,7 @@ pub struct ListModelIter<'a, T: IsA<glib::Object>> {
changed: Rc<Cell<bool>>,
signal_id: Option<SignalHandlerId>,
}
impl<'a, T: IsA<glib::Object>> Iterator for ListModelIter<'a, T> {
impl<T: IsA<glib::Object>> Iterator for ListModelIter<'_, T> {
type Item = Result<T, ListModelMutatedDuringIter>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down Expand Up @@ -139,11 +138,11 @@ impl<'a, T: IsA<glib::Object>> Iterator for ListModelIter<'a, T> {
}
}

impl<'a, T: IsA<glib::Object>> FusedIterator for ListModelIter<'a, T> {}
impl<T: IsA<glib::Object>> FusedIterator for ListModelIter<'_, T> {}

impl<'a, T: IsA<glib::Object>> ExactSizeIterator for ListModelIter<'a, T> {}
impl<T: IsA<glib::Object>> ExactSizeIterator for ListModelIter<'_, T> {}

impl<'a, T: IsA<glib::Object>> DoubleEndedIterator for ListModelIter<'a, T> {
impl<T: IsA<glib::Object>> DoubleEndedIterator for ListModelIter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.reverse_pos == self.i {
return None;
Expand Down Expand Up @@ -178,7 +177,7 @@ impl<'a, T: IsA<glib::Object>> DoubleEndedIterator for ListModelIter<'a, T> {
}
}
}
impl<'a, T: IsA<glib::Object>> Drop for ListModelIter<'a, T> {
impl<T: IsA<glib::Object>> Drop for ListModelIter<'_, T> {
#[inline]
fn drop(&mut self) {
self.model.disconnect(self.signal_id.take().unwrap());
Expand Down
2 changes: 1 addition & 1 deletion gio/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct BindingBuilder<'a> {
set_mapping: Option<Box<dyn Fn(&glib::Value, glib::VariantType) -> Option<glib::Variant>>>,
}

impl<'a> BindingBuilder<'a> {
impl BindingBuilder<'_> {
pub fn flags(mut self, flags: SettingsBindFlags) -> Self {
self.flags = flags;
self
Expand Down
14 changes: 7 additions & 7 deletions gio/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ impl<'v> InputVector<'v> {
}
}

unsafe impl<'v> Send for InputVector<'v> {}
unsafe impl<'v> Sync for InputVector<'v> {}
unsafe impl Send for InputVector<'_> {}
unsafe impl Sync for InputVector<'_> {}

impl<'v> std::ops::Deref for InputVector<'v> {
impl std::ops::Deref for InputVector<'_> {
type Target = [u8];

#[inline]
Expand All @@ -93,7 +93,7 @@ impl<'v> std::ops::Deref for InputVector<'v> {
}
}

impl<'v> std::ops::DerefMut for InputVector<'v> {
impl std::ops::DerefMut for InputVector<'_> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { std::slice::from_raw_parts_mut(self.vector.buffer as *mut _, self.vector.size) }
Expand Down Expand Up @@ -230,10 +230,10 @@ impl<'v> OutputVector<'v> {
}
}

unsafe impl<'v> Send for OutputVector<'v> {}
unsafe impl<'v> Sync for OutputVector<'v> {}
unsafe impl Send for OutputVector<'_> {}
unsafe impl Sync for OutputVector<'_> {}

impl<'v> std::ops::Deref for OutputVector<'v> {
impl std::ops::Deref for OutputVector<'_> {
type Target = [u8];

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion gio/src/unix_fd_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub trait UnixFDListExtManual: IsA<UnixFDList> + Sized {
}

#[doc(alias = "g_unix_fd_list_peek_fds")]

fn peek_fds(&self) -> Vec<RawFd> {
unsafe {
let mut length = mem::MaybeUninit::uninit();
Expand All @@ -66,6 +65,7 @@ pub trait UnixFDListExtManual: IsA<UnixFDList> + Sized {
ret
}
}

#[doc(alias = "g_unix_fd_list_steal_fds")]
fn steal_fds(&self) -> Vec<RawFd> {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion gio/src/unix_socket_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum UnixSocketAddressPath<'a> {
AbstractPadded(&'a [u8]),
}

impl<'a> UnixSocketAddressPath<'a> {
impl UnixSocketAddressPath<'_> {
fn to_type(&self) -> UnixSocketAddressType {
use self::UnixSocketAddressPath::*;

Expand Down
2 changes: 1 addition & 1 deletion glib-macros/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) enum CaptureKind {
ToOwned,
}

impl<'a> TryFrom<&'a Ident> for CaptureKind {
impl TryFrom<&'_ Ident> for CaptureKind {
type Error = syn::Error;

fn try_from(s: &Ident) -> Result<Self, Self::Error> {
Expand Down
4 changes: 2 additions & 2 deletions glib/src/collections/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ impl<'a, T: TransparentPtrType> Iterator for Iter<'a, T> {
}
}

impl<'a, T: TransparentPtrType> FusedIterator for Iter<'a, T> {}
impl<T: TransparentPtrType> FusedIterator for Iter<'_, T> {}

// rustdoc-stripper-ignore-next
/// A non-destructive iterator over a [`List`].
Expand Down Expand Up @@ -708,7 +708,7 @@ impl<'a, T: TransparentPtrType> Iterator for IterMut<'a, T> {
}
}

impl<'a, T: TransparentPtrType> FusedIterator for IterMut<'a, T> {}
impl<T: TransparentPtrType> FusedIterator for IterMut<'_, T> {}

// rustdoc-stripper-ignore-next
/// A destructive iterator over a [`List`].
Expand Down
4 changes: 2 additions & 2 deletions glib/src/collections/ptr_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ impl<T: TransparentPtrType> IntoPtrSlice<T> for PtrSlice<T> {
}
}

impl<'a, T: TransparentPtrType> IntoPtrSlice<T> for &'a PtrSlice<T> {
impl<T: TransparentPtrType> IntoPtrSlice<T> for &'_ PtrSlice<T> {
#[inline]
fn run_with_ptr_slice<R, F: FnOnce(&[<T as GlibPtrDefault>::GlibType]) -> R>(self, f: F) -> R {
f(unsafe { std::slice::from_raw_parts(self.as_ptr() as *mut _, self.len() + 1) })
Expand Down Expand Up @@ -1160,7 +1160,7 @@ impl<T: TransparentPtrType, const N: usize> IntoPtrSlice<T> for [T; N] {
}
}

impl<'a, T: TransparentPtrType> IntoPtrSlice<T> for &'a [T] {
impl<T: TransparentPtrType> IntoPtrSlice<T> for &'_ [T] {
#[inline]
fn run_with_ptr_slice<R, F: FnOnce(&[<T as GlibPtrDefault>::GlibType]) -> R>(self, f: F) -> R {
if self.len() < MAX_STACK_ALLOCATION {
Expand Down
4 changes: 2 additions & 2 deletions glib/src/collections/slist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ impl<'a, T: TransparentPtrType> Iterator for Iter<'a, T> {
}
}

impl<'a, T: TransparentPtrType> FusedIterator for Iter<'a, T> {}
impl<T: TransparentPtrType> FusedIterator for Iter<'_, T> {}

// rustdoc-stripper-ignore-next
/// A non-destructive iterator over a [`SList`].
Expand Down Expand Up @@ -702,7 +702,7 @@ impl<'a, T: TransparentPtrType> Iterator for IterMut<'a, T> {
}
}

impl<'a, T: TransparentPtrType> FusedIterator for IterMut<'a, T> {}
impl<T: TransparentPtrType> FusedIterator for IterMut<'_, T> {}

// rustdoc-stripper-ignore-next
/// A destructive iterator over a [`SList`].
Expand Down
Loading

0 comments on commit b242ce7

Please sign in to comment.