diff --git a/cairo/src/device.rs b/cairo/src/device.rs index 34400e5e7dbc..c35069396561 100644 --- a/cairo/src/device.rs +++ b/cairo/src/device.rs @@ -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(); diff --git a/cairo/src/image_surface.rs b/cairo/src/image_surface.rs index 15c1cc7395d9..1c50e00990ab 100644 --- a/cairo/src/image_surface.rs +++ b/cairo/src/image_surface.rs @@ -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> { @@ -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 { @@ -264,7 +264,7 @@ impl<'a> Drop for ImageSurfaceData<'a> { } } -impl<'a> Deref for ImageSurfaceData<'a> { +impl Deref for ImageSurfaceData<'_> { type Target = [u8]; #[inline] @@ -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; diff --git a/cairo/src/paths.rs b/cairo/src/paths.rs index 65b2e9dfe808..f870d3165905 100644 --- a/cairo/src/paths.rs +++ b/cairo/src/paths.rs @@ -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 { @@ -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]) diff --git a/gdk-pixbuf/src/lib.rs b/gdk-pixbuf/src/lib.rs index 27f100b07564..068b1eb54dbf 100644 --- a/gdk-pixbuf/src/lib.rs +++ b/gdk-pixbuf/src/lib.rs @@ -8,6 +8,7 @@ pub use gio; pub use glib; #[allow(clippy::too_many_arguments)] +#[allow(clippy::manual_c_str_literals)] mod auto; pub mod subclass; diff --git a/gio/src/dbus_connection.rs b/gio/src/dbus_connection.rs index f7ee74e7fbf7..982c2f8a164c 100644 --- a/gio/src/dbus_connection.rs +++ b/gio/src/dbus_connection.rs @@ -38,7 +38,7 @@ pub struct RegistrationBuilder<'a> { Option bool>>, } -impl<'a> RegistrationBuilder<'a> { +impl RegistrationBuilder<'_> { pub fn method_call< F: Fn(DBusConnection, &str, &str, &str, &str, glib::Variant, DBusMethodInvocation) + 'static, >( diff --git a/gio/src/inet_address.rs b/gio/src/inet_address.rs index 663ce63f47be..2ecbbfd524ff 100644 --- a/gio/src/inet_address.rs +++ b/gio/src/inet_address.rs @@ -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::*; diff --git a/gio/src/lib.rs b/gio/src/lib.rs index b559db77329d..da084ca7d6a3 100644 --- a/gio/src/lib.rs +++ b/gio/src/lib.rs @@ -4,6 +4,7 @@ #![allow(clippy::type_complexity)] #![allow(clippy::too_many_arguments)] #![allow(clippy::missing_safety_doc)] +#![allow(clippy::manual_c_str_literals)] #![doc = include_str!("../README.md")] pub use gio_sys as ffi; diff --git a/gio/src/list_model.rs b/gio/src/list_model.rs index 1ed07966b36d..1c9874948707 100644 --- a/gio/src/list_model.rs +++ b/gio/src/list_model.rs @@ -26,7 +26,6 @@ pub trait ListModelExtManual: IsA + Sized { /// # Panics /// /// Panics if `T::static_type().is_a(self.item_type())` is not true. - fn iter>(&self) -> ListModelIter { assert!(self.item_type().is_a(LT::static_type())); @@ -80,7 +79,7 @@ pub struct ListModelIter<'a, T: IsA> { changed: Rc>, signal_id: Option, } -impl<'a, T: IsA> Iterator for ListModelIter<'a, T> { +impl> Iterator for ListModelIter<'_, T> { type Item = Result; fn next(&mut self) -> Option { @@ -139,11 +138,11 @@ impl<'a, T: IsA> Iterator for ListModelIter<'a, T> { } } -impl<'a, T: IsA> FusedIterator for ListModelIter<'a, T> {} +impl> FusedIterator for ListModelIter<'_, T> {} -impl<'a, T: IsA> ExactSizeIterator for ListModelIter<'a, T> {} +impl> ExactSizeIterator for ListModelIter<'_, T> {} -impl<'a, T: IsA> DoubleEndedIterator for ListModelIter<'a, T> { +impl> DoubleEndedIterator for ListModelIter<'_, T> { fn next_back(&mut self) -> Option { if self.reverse_pos == self.i { return None; @@ -178,7 +177,7 @@ impl<'a, T: IsA> DoubleEndedIterator for ListModelIter<'a, T> { } } } -impl<'a, T: IsA> Drop for ListModelIter<'a, T> { +impl> Drop for ListModelIter<'_, T> { #[inline] fn drop(&mut self) { self.model.disconnect(self.signal_id.take().unwrap()); diff --git a/gio/src/settings.rs b/gio/src/settings.rs index 57bc9cec95a4..5d5a638bd9f2 100644 --- a/gio/src/settings.rs +++ b/gio/src/settings.rs @@ -17,7 +17,7 @@ pub struct BindingBuilder<'a> { set_mapping: Option Option>>, } -impl<'a> BindingBuilder<'a> { +impl BindingBuilder<'_> { pub fn flags(mut self, flags: SettingsBindFlags) -> Self { self.flags = flags; self diff --git a/gio/src/socket.rs b/gio/src/socket.rs index 5178f859a69a..507e3ff6f58a 100644 --- a/gio/src/socket.rs +++ b/gio/src/socket.rs @@ -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] @@ -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) } @@ -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] diff --git a/gio/src/unix_fd_list.rs b/gio/src/unix_fd_list.rs index 24e7048f044e..220bc7f970f9 100644 --- a/gio/src/unix_fd_list.rs +++ b/gio/src/unix_fd_list.rs @@ -55,7 +55,6 @@ pub trait UnixFDListExtManual: IsA + Sized { } #[doc(alias = "g_unix_fd_list_peek_fds")] - fn peek_fds(&self) -> Vec { unsafe { let mut length = mem::MaybeUninit::uninit(); @@ -66,6 +65,7 @@ pub trait UnixFDListExtManual: IsA + Sized { ret } } + #[doc(alias = "g_unix_fd_list_steal_fds")] fn steal_fds(&self) -> Vec { unsafe { diff --git a/gio/src/unix_socket_address.rs b/gio/src/unix_socket_address.rs index 59cc1ba41ffe..b0f347491bdb 100644 --- a/gio/src/unix_socket_address.rs +++ b/gio/src/unix_socket_address.rs @@ -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::*; diff --git a/glib-macros/src/clone.rs b/glib-macros/src/clone.rs index 2737055d0511..1f18f1bcacff 100644 --- a/glib-macros/src/clone.rs +++ b/glib-macros/src/clone.rs @@ -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 { diff --git a/glib/src/collections/list.rs b/glib/src/collections/list.rs index 18845a80f7e6..c2c8096d72fa 100644 --- a/glib/src/collections/list.rs +++ b/glib/src/collections/list.rs @@ -666,7 +666,7 @@ impl<'a, T: TransparentPtrType> Iterator for Iter<'a, T> { } } -impl<'a, T: TransparentPtrType> FusedIterator for Iter<'a, T> {} +impl FusedIterator for Iter<'_, T> {} // rustdoc-stripper-ignore-next /// A non-destructive iterator over a [`List`]. @@ -708,7 +708,7 @@ impl<'a, T: TransparentPtrType> Iterator for IterMut<'a, T> { } } -impl<'a, T: TransparentPtrType> FusedIterator for IterMut<'a, T> {} +impl FusedIterator for IterMut<'_, T> {} // rustdoc-stripper-ignore-next /// A destructive iterator over a [`List`]. diff --git a/glib/src/collections/ptr_slice.rs b/glib/src/collections/ptr_slice.rs index 4c19b0655ad5..62d2653e34c3 100644 --- a/glib/src/collections/ptr_slice.rs +++ b/glib/src/collections/ptr_slice.rs @@ -1097,7 +1097,7 @@ impl IntoPtrSlice for PtrSlice { } } -impl<'a, T: TransparentPtrType> IntoPtrSlice for &'a PtrSlice { +impl IntoPtrSlice for &'_ PtrSlice { #[inline] fn run_with_ptr_slice::GlibType]) -> R>(self, f: F) -> R { f(unsafe { std::slice::from_raw_parts(self.as_ptr() as *mut _, self.len() + 1) }) @@ -1160,7 +1160,7 @@ impl IntoPtrSlice for [T; N] { } } -impl<'a, T: TransparentPtrType> IntoPtrSlice for &'a [T] { +impl IntoPtrSlice for &'_ [T] { #[inline] fn run_with_ptr_slice::GlibType]) -> R>(self, f: F) -> R { if self.len() < MAX_STACK_ALLOCATION { diff --git a/glib/src/collections/slist.rs b/glib/src/collections/slist.rs index d8cf1e40fca3..fce48dd52645 100644 --- a/glib/src/collections/slist.rs +++ b/glib/src/collections/slist.rs @@ -660,7 +660,7 @@ impl<'a, T: TransparentPtrType> Iterator for Iter<'a, T> { } } -impl<'a, T: TransparentPtrType> FusedIterator for Iter<'a, T> {} +impl FusedIterator for Iter<'_, T> {} // rustdoc-stripper-ignore-next /// A non-destructive iterator over a [`SList`]. @@ -702,7 +702,7 @@ impl<'a, T: TransparentPtrType> Iterator for IterMut<'a, T> { } } -impl<'a, T: TransparentPtrType> FusedIterator for IterMut<'a, T> {} +impl FusedIterator for IterMut<'_, T> {} // rustdoc-stripper-ignore-next /// A destructive iterator over a [`SList`]. diff --git a/glib/src/collections/strv.rs b/glib/src/collections/strv.rs index 53fe12666671..05ec5821c373 100644 --- a/glib/src/collections/strv.rs +++ b/glib/src/collections/strv.rs @@ -63,8 +63,8 @@ impl std::hash::Hash for StrV { } } -impl<'a> PartialEq<[&'a str]> for StrV { - fn eq(&self, other: &[&'a str]) -> bool { +impl PartialEq<[&'_ str]> for StrV { + fn eq(&self, other: &[&'_ str]) -> bool { for (a, b) in Iterator::zip(self.iter(), other.iter()) { if a != b { return false; @@ -75,7 +75,7 @@ impl<'a> PartialEq<[&'a str]> for StrV { } } -impl<'a> PartialEq for [&'a str] { +impl PartialEq for [&'_ str] { #[inline] fn eq(&self, other: &StrV) -> bool { other.eq(self) @@ -304,9 +304,9 @@ impl From> for StrV { } } -impl<'a> From> for StrV { +impl From> for StrV { #[inline] - fn from(value: Vec<&'a str>) -> Self { + fn from(value: Vec<&'_ str>) -> Self { value.as_slice().into() } } @@ -359,9 +359,9 @@ impl From<[String; N]> for StrV { } } -impl<'a, const N: usize> From<[&'a str; N]> for StrV { +impl From<[&'_ str; N]> for StrV { #[inline] - fn from(value: [&'a str; N]) -> Self { + fn from(value: [&'_ str; N]) -> Self { unsafe { let mut s = Self::with_capacity(value.len()); for (i, item) in value.iter().enumerate() { @@ -374,9 +374,9 @@ impl<'a, const N: usize> From<[&'a str; N]> for StrV { } } -impl<'a, const N: usize> From<[&'a GStr; N]> for StrV { +impl From<[&'_ GStr; N]> for StrV { #[inline] - fn from(value: [&'a GStr; N]) -> Self { + fn from(value: [&'_ GStr; N]) -> Self { unsafe { let mut s = Self::with_capacity(value.len()); for (i, item) in value.iter().enumerate() { @@ -389,9 +389,9 @@ impl<'a, const N: usize> From<[&'a GStr; N]> for StrV { } } -impl<'a> From<&'a [&'a str]> for StrV { +impl From<&'_ [&'_ str]> for StrV { #[inline] - fn from(value: &'a [&'a str]) -> Self { + fn from(value: &'_ [&'_ str]) -> Self { unsafe { let mut s = Self::with_capacity(value.len()); for (i, item) in value.iter().enumerate() { @@ -404,9 +404,9 @@ impl<'a> From<&'a [&'a str]> for StrV { } } -impl<'a> From<&'a [&'a GStr]> for StrV { +impl From<&'_ [&'_ GStr]> for StrV { #[inline] - fn from(value: &'a [&'a GStr]) -> Self { + fn from(value: &'_ [&'_ GStr]) -> Self { unsafe { let mut s = Self::with_capacity(value.len()); for (i, item) in value.iter().enumerate() { @@ -1022,7 +1022,7 @@ impl StaticType for StrV { } } -impl<'a> StaticType for &'a [GStringPtr] { +impl StaticType for &'_ [GStringPtr] { #[inline] fn static_type() -> crate::Type { >::static_type() @@ -1097,7 +1097,7 @@ impl IntoStrV for StrV { } } -impl<'a> IntoStrV for &'a StrV { +impl IntoStrV for &'_ StrV { #[inline] fn run_with_strv R>(self, f: F) -> R { f(unsafe { std::slice::from_raw_parts(self.as_ptr(), self.len()) }) @@ -1117,21 +1117,21 @@ impl IntoStrV for Vec { } } -impl<'a> IntoStrV for Vec<&'a GString> { +impl IntoStrV for Vec<&'_ GString> { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) } } -impl<'a> IntoStrV for Vec<&'a GStr> { +impl IntoStrV for Vec<&'_ GStr> { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) } } -impl<'a> IntoStrV for Vec<&'a str> { +impl IntoStrV for Vec<&'_ str> { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) @@ -1145,7 +1145,7 @@ impl IntoStrV for Vec { } } -impl<'a> IntoStrV for Vec<&'a String> { +impl IntoStrV for Vec<&'_ String> { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) @@ -1177,7 +1177,7 @@ impl IntoStrV for &[GString] { } } -impl<'a> IntoStrV for &[&'a GString] { +impl IntoStrV for &[&GString] { #[inline] fn run_with_strv R>(self, f: F) -> R { let required_len = (self.len() + 1) * mem::size_of::<*mut c_char>(); @@ -1202,7 +1202,7 @@ impl<'a> IntoStrV for &[&'a GString] { } } -impl<'a> IntoStrV for &[&'a GStr] { +impl IntoStrV for &[&GStr] { #[inline] fn run_with_strv R>(self, f: F) -> R { let required_len = (self.len() + 1) * mem::size_of::<*mut c_char>(); @@ -1227,7 +1227,7 @@ impl<'a> IntoStrV for &[&'a GStr] { } } -impl<'a> IntoStrV for &[&'a str] { +impl IntoStrV for &[&str] { #[inline] fn run_with_strv R>(self, f: F) -> R { let required_len = (self.len() + 1) * mem::size_of::<*mut c_char>() @@ -1287,7 +1287,7 @@ impl IntoStrV for &[String] { } } -impl<'a> IntoStrV for &[&'a String] { +impl IntoStrV for &[&String] { #[inline] fn run_with_strv R>(self, f: F) -> R { let required_len = (self.len() + 1) * mem::size_of::<*mut c_char>() @@ -1324,21 +1324,21 @@ impl IntoStrV for [GString; N] { } } -impl<'a, const N: usize> IntoStrV for [&'a GString; N] { +impl IntoStrV for [&'_ GString; N] { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) } } -impl<'a, const N: usize> IntoStrV for [&'a GStr; N] { +impl IntoStrV for [&'_ GStr; N] { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) } } -impl<'a, const N: usize> IntoStrV for [&'a str; N] { +impl IntoStrV for [&'_ str; N] { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) @@ -1352,7 +1352,7 @@ impl IntoStrV for [String; N] { } } -impl<'a, const N: usize> IntoStrV for [&'a String; N] { +impl IntoStrV for [&'_ String; N] { #[inline] fn run_with_strv R>(self, f: F) -> R { self.as_slice().run_with_strv(f) diff --git a/glib/src/enums.rs b/glib/src/enums.rs index 1b812e3dc123..642f4b179b34 100644 --- a/glib/src/enums.rs +++ b/glib/src/enums.rs @@ -338,7 +338,7 @@ impl UnsafeFrom for EnumValue { } } -unsafe impl<'a, 'b> crate::value::FromValue<'a> for &'b EnumValue { +unsafe impl<'a> crate::value::FromValue<'a> for &EnumValue { type Checker = EnumTypeChecker; unsafe fn from_value(value: &'a Value) -> Self { @@ -965,7 +965,7 @@ pub type FlagsValues = EnumerationValues; /// If setting/unsetting any value fails, `build()` returns `None`. #[must_use = "The builder must be built to be used"] pub struct FlagsBuilder<'a>(&'a FlagsClass, Option); -impl<'a> FlagsBuilder<'a> { +impl FlagsBuilder<'_> { fn new(flags_class: &FlagsClass) -> FlagsBuilder { let value = unsafe { Value::from_type_unchecked(flags_class.type_()) }; FlagsBuilder(flags_class, Some(value)) @@ -1043,7 +1043,7 @@ impl<'a> FlagsBuilder<'a> { } } -unsafe impl<'a, 'b> crate::value::FromValue<'a> for Vec<&'b FlagsValue> { +unsafe impl<'a> crate::value::FromValue<'a> for Vec<&FlagsValue> { type Checker = FlagsTypeChecker; unsafe fn from_value(value: &'a Value) -> Self { diff --git a/glib/src/gstring.rs b/glib/src/gstring.rs index f1b51db85b25..0ef5674ce25b 100644 --- a/glib/src/gstring.rs +++ b/glib/src/gstring.rs @@ -1988,7 +1988,7 @@ impl<'a> From<&'a GString> for Cow<'a, GStr> { } } -impl<'a> From for Cow<'a, GStr> { +impl From for Cow<'_, GStr> { #[inline] fn from(v: GString) -> Self { Cow::Owned(v) diff --git a/glib/src/main_context.rs b/glib/src/main_context.rs index 90aab2fbf4be..1213046bde55 100644 --- a/glib/src/main_context.rs +++ b/glib/src/main_context.rs @@ -176,7 +176,7 @@ impl MainContext { #[must_use = "if unused the main context will be released immediately"] pub struct MainContextAcquireGuard<'a>(&'a MainContext); -impl<'a> Drop for MainContextAcquireGuard<'a> { +impl Drop for MainContextAcquireGuard<'_> { #[doc(alias = "g_main_context_release")] #[inline] fn drop(&mut self) { @@ -188,7 +188,7 @@ impl<'a> Drop for MainContextAcquireGuard<'a> { struct ThreadDefaultContext<'a>(&'a MainContext); -impl<'a> ThreadDefaultContext<'a> { +impl ThreadDefaultContext<'_> { fn new(ctx: &MainContext) -> ThreadDefaultContext { unsafe { ffi::g_main_context_push_thread_default(ctx.to_glib_none().0); @@ -197,7 +197,7 @@ impl<'a> ThreadDefaultContext<'a> { } } -impl<'a> Drop for ThreadDefaultContext<'a> { +impl Drop for ThreadDefaultContext<'_> { #[inline] fn drop(&mut self) { unsafe { diff --git a/glib/src/match_info.rs b/glib/src/match_info.rs index 5de4baf782ac..488c7a214472 100644 --- a/glib/src/match_info.rs +++ b/glib/src/match_info.rs @@ -49,11 +49,11 @@ impl MatchInfo<'_> { } #[doc(hidden)] -impl<'input> GlibPtrDefault for MatchInfo<'input> { +impl GlibPtrDefault for MatchInfo<'_> { type GlibType = *mut ffi::GMatchInfo; } #[doc(hidden)] -unsafe impl<'input> TransparentPtrType for MatchInfo<'input> {} +unsafe impl TransparentPtrType for MatchInfo<'_> {} #[doc(hidden)] impl<'a, 'input> ToGlibPtr<'a, *mut ffi::GMatchInfo> for MatchInfo<'input> @@ -95,7 +95,7 @@ where } #[doc(hidden)] -impl<'input> FromGlibPtrNone<*mut ffi::GMatchInfo> for MatchInfo<'input> { +impl FromGlibPtrNone<*mut ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn from_glib_none(ptr: *mut ffi::GMatchInfo) -> Self { debug_assert!(!ptr.is_null()); @@ -109,14 +109,14 @@ impl<'input> FromGlibPtrNone<*mut ffi::GMatchInfo> for MatchInfo<'input> { } } #[doc(hidden)] -impl<'input> FromGlibPtrNone<*const ffi::GMatchInfo> for MatchInfo<'input> { +impl FromGlibPtrNone<*const ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn from_glib_none(ptr: *const ffi::GMatchInfo) -> Self { Self::from_glib_none(ptr.cast_mut()) } } #[doc(hidden)] -impl<'input> FromGlibPtrFull<*mut ffi::GMatchInfo> for MatchInfo<'input> { +impl FromGlibPtrFull<*mut ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn from_glib_full(ptr: *mut ffi::GMatchInfo) -> Self { debug_assert!(!ptr.is_null()); @@ -129,7 +129,7 @@ impl<'input> FromGlibPtrFull<*mut ffi::GMatchInfo> for MatchInfo<'input> { } } #[doc(hidden)] -impl<'input> FromGlibPtrBorrow<*mut ffi::GMatchInfo> for MatchInfo<'input> { +impl FromGlibPtrBorrow<*mut ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn from_glib_borrow(ptr: *mut ffi::GMatchInfo) -> Borrowed { debug_assert!(!ptr.is_null()); @@ -142,7 +142,7 @@ impl<'input> FromGlibPtrBorrow<*mut ffi::GMatchInfo> for MatchInfo<'input> { } } #[doc(hidden)] -impl<'input> FromGlibPtrBorrow<*const ffi::GMatchInfo> for MatchInfo<'input> { +impl FromGlibPtrBorrow<*const ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn from_glib_borrow(ptr: *const ffi::GMatchInfo) -> Borrowed { from_glib_borrow::<_, Self>(ptr.cast_mut()) @@ -150,7 +150,7 @@ impl<'input> FromGlibPtrBorrow<*const ffi::GMatchInfo> for MatchInfo<'input> { } #[doc(hidden)] -impl<'input> IntoGlibPtr<*mut ffi::GMatchInfo> for MatchInfo<'input> { +impl IntoGlibPtr<*mut ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn into_glib_ptr(self) -> *mut ffi::GMatchInfo { let s = std::mem::ManuallyDrop::new(self); @@ -158,14 +158,14 @@ impl<'input> IntoGlibPtr<*mut ffi::GMatchInfo> for MatchInfo<'input> { } } #[doc(hidden)] -impl<'input> IntoGlibPtr<*const ffi::GMatchInfo> for MatchInfo<'input> { +impl IntoGlibPtr<*const ffi::GMatchInfo> for MatchInfo<'_> { #[inline] unsafe fn into_glib_ptr(self) -> *const ffi::GMatchInfo { let s = std::mem::ManuallyDrop::new(self); ToGlibPtr::<*const ffi::GMatchInfo>::to_glib_none(&*s).0 as *const _ } } -impl<'input> StaticType for MatchInfo<'input> { +impl StaticType for MatchInfo<'_> { #[inline] fn static_type() -> crate::types::Type { unsafe { from_glib(ffi::g_match_info_get_type()) } diff --git a/glib/src/object.rs b/glib/src/object.rs index b72134d2e180..9eefb0dc591a 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -3198,7 +3198,7 @@ impl Watchable for T { } #[doc(hidden)] -impl<'a, T: ObjectType> Watchable for BorrowedObject<'a, T> { +impl Watchable for BorrowedObject<'_, T> { fn watched_object(&self) -> WatchedObject { WatchedObject::new(self) } @@ -3650,7 +3650,7 @@ pub struct BindingBuilder<'a, 'f, 't> { transform_to: TransformFn<'t>, } -impl<'a, 'f, 't> fmt::Debug for BindingBuilder<'a, 'f, 't> { +impl fmt::Debug for BindingBuilder<'_, '_, '_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BindingBuilder") .field("source", &self.source) @@ -4073,7 +4073,7 @@ impl AsMut for Class { #[derive(Debug)] pub struct ClassRef<'a, T: IsClass>(ptr::NonNull>, bool, PhantomData<&'a ()>); -impl<'a, T: IsClass> ops::Deref for ClassRef<'a, T> { +impl ops::Deref for ClassRef<'_, T> { type Target = Class; #[inline] @@ -4082,7 +4082,7 @@ impl<'a, T: IsClass> ops::Deref for ClassRef<'a, T> { } } -impl<'a, T: IsClass> Drop for ClassRef<'a, T> { +impl Drop for ClassRef<'_, T> { #[inline] fn drop(&mut self) { if self.1 { @@ -4093,8 +4093,8 @@ impl<'a, T: IsClass> Drop for ClassRef<'a, T> { } } -unsafe impl<'a, T: IsClass> Send for ClassRef<'a, T> {} -unsafe impl<'a, T: IsClass> Sync for ClassRef<'a, T> {} +unsafe impl Send for ClassRef<'_, T> {} +unsafe impl Sync for ClassRef<'_, T> {} // This should require Self: IsA, but that seems to cause a cycle error pub unsafe trait ParentClassIs: IsClass { @@ -4339,7 +4339,7 @@ impl AsMut for Interface { #[derive(Debug)] pub struct InterfaceRef<'a, T: IsInterface>(ptr::NonNull>, bool, PhantomData<&'a ()>); -impl<'a, T: IsInterface> Drop for InterfaceRef<'a, T> { +impl Drop for InterfaceRef<'_, T> { #[inline] fn drop(&mut self) { if self.1 { @@ -4350,7 +4350,7 @@ impl<'a, T: IsInterface> Drop for InterfaceRef<'a, T> { } } -impl<'a, T: IsInterface> ops::Deref for InterfaceRef<'a, T> { +impl ops::Deref for InterfaceRef<'_, T> { type Target = Interface; #[inline] @@ -4359,8 +4359,8 @@ impl<'a, T: IsInterface> ops::Deref for InterfaceRef<'a, T> { } } -unsafe impl<'a, T: IsInterface> Send for InterfaceRef<'a, T> {} -unsafe impl<'a, T: IsInterface> Sync for InterfaceRef<'a, T> {} +unsafe impl Send for InterfaceRef<'_, T> {} +unsafe impl Sync for InterfaceRef<'_, T> {} // rustdoc-stripper-ignore-next /// Trait implemented by interface types. @@ -4435,8 +4435,8 @@ pub struct BorrowedObject<'a, T> { phantom: PhantomData<&'a T>, } -unsafe impl<'a, T: Send + Sync> Send for BorrowedObject<'a, T> {} -unsafe impl<'a, T: Send + Sync> Sync for BorrowedObject<'a, T> {} +unsafe impl Send for BorrowedObject<'_, T> {} +unsafe impl Sync for BorrowedObject<'_, T> {} impl<'a, T: ObjectType> BorrowedObject<'a, T> { // rustdoc-stripper-ignore-next @@ -4464,7 +4464,7 @@ impl<'a, T: ObjectType> BorrowedObject<'a, T> { } } -impl<'a, T> ops::Deref for BorrowedObject<'a, T> { +impl ops::Deref for BorrowedObject<'_, T> { type Target = T; #[inline] @@ -4473,30 +4473,28 @@ impl<'a, T> ops::Deref for BorrowedObject<'a, T> { } } -impl<'a, T> AsRef for BorrowedObject<'a, T> { +impl AsRef for BorrowedObject<'_, T> { #[inline] fn as_ref(&self) -> &T { unsafe { &*(&self.ptr as *const _ as *const T) } } } -impl<'a, T: PartialEq> PartialEq for BorrowedObject<'a, T> { +impl PartialEq for BorrowedObject<'_, T> { #[inline] fn eq(&self, other: &T) -> bool { ::eq(self, other) } } -impl<'a, T: PartialOrd> PartialOrd for BorrowedObject<'a, T> { +impl PartialOrd for BorrowedObject<'_, T> { #[inline] fn partial_cmp(&self, other: &T) -> Option { ::partial_cmp(self, other) } } -impl<'a, T: crate::clone::Downgrade + ObjectType> crate::clone::Downgrade - for BorrowedObject<'a, T> -{ +impl crate::clone::Downgrade for BorrowedObject<'_, T> { type Weak = ::Weak; #[inline] diff --git a/glib/src/translate.rs b/glib/src/translate.rs index 0744f4285acc..390242f2cc68 100644 --- a/glib/src/translate.rs +++ b/glib/src/translate.rs @@ -425,7 +425,7 @@ pub trait GlibPtrDefault { type GlibType: Ptr; } -impl<'a, T: ?Sized + GlibPtrDefault> GlibPtrDefault for &'a T { +impl GlibPtrDefault for &T { type GlibType = ::GlibType; } @@ -468,7 +468,7 @@ pub trait ToGlibPtrMut<'a, P: Copy> { /// /// The pointer in the `Stash` is only valid for the lifetime of the `Stash`. #[allow(clippy::wrong_self_convention)] - fn to_glib_none_mut(&'a mut self) -> StashMut; + fn to_glib_none_mut(&'a mut self) -> StashMut<'a, P, Self>; } impl<'a, P: Ptr, T: ToGlibPtr<'a, P>> ToGlibPtr<'a, P> for Option { diff --git a/glib/src/types.rs b/glib/src/types.rs index bf300164ac81..15c38be9c5f4 100644 --- a/glib/src/types.rs +++ b/glib/src/types.rs @@ -355,14 +355,14 @@ impl From for crate::Value { } } -impl<'a, T: ?Sized + StaticType> StaticType for &'a T { +impl StaticType for &'_ T { #[inline] fn static_type() -> Type { T::static_type() } } -impl<'a, T: ?Sized + StaticType> StaticType for &'a mut T { +impl StaticType for &'_ mut T { #[inline] fn static_type() -> Type { T::static_type() @@ -555,7 +555,7 @@ builtin!(PathBuf, STRING); builtin!(Path, STRING); builtin!(Pointer, POINTER); -impl<'a> StaticType for [&'a str] { +impl StaticType for [&'_ str] { #[inline] fn static_type() -> Type { unsafe { from_glib(ffi::g_strv_get_type()) } diff --git a/glib/src/value.rs b/glib/src/value.rs index 157083d87e1e..42cdd7b267a6 100644 --- a/glib/src/value.rs +++ b/glib/src/value.rs @@ -571,7 +571,9 @@ impl Value { /// /// Returns `Ok` if the type is correct. #[inline] - pub fn get<'a, T>(&'a self) -> Result::Checker as ValueTypeChecker>::Error> + pub fn get<'a, T>( + &'a self, + ) -> Result>::Checker as ValueTypeChecker>::Error> where T: FromValue<'a>, { @@ -727,7 +729,7 @@ impl ToValue for Value { } } -impl<'a> ToValue for &'a Value { +impl ToValue for &Value { #[inline] fn to_value(&self) -> Value { (*self).clone() @@ -780,7 +782,7 @@ impl ToValue for SendValue { } } -impl<'a> ToValue for &'a SendValue { +impl ToValue for &SendValue { #[inline] fn to_value(&self) -> Value { unsafe { from_glib_none(self.to_glib_none().0) } @@ -1034,7 +1036,7 @@ impl From> for Value { } } -impl<'a> ToValue for [&'a str] { +impl ToValue for [&'_ str] { fn to_value(&self) -> Value { unsafe { let mut value = Value::for_value_type::>(); @@ -1049,7 +1051,7 @@ impl<'a> ToValue for [&'a str] { } } -impl<'a> ToValue for &'a [&'a str] { +impl ToValue for &'_ [&'_ str] { fn to_value(&self) -> Value { unsafe { let mut value = Value::for_value_type::>(); diff --git a/glib/src/variant.rs b/glib/src/variant.rs index d1df3bae1617..df8f0e1ca7a6 100644 --- a/glib/src/variant.rs +++ b/glib/src/variant.rs @@ -998,7 +998,7 @@ impl StaticVariantType for Variant { } } -impl<'a, T: ?Sized + ToVariant> ToVariant for &'a T { +impl ToVariant for &T { fn to_variant(&self) -> Variant { ::to_variant(self) } @@ -1011,7 +1011,7 @@ impl<'a, T: Into + Clone> From<&'a T> for Variant { } } -impl<'a, T: ?Sized + StaticVariantType> StaticVariantType for &'a T { +impl StaticVariantType for &T { fn static_variant_type() -> Cow<'static, VariantTy> { ::static_variant_type() } diff --git a/glib/src/variant_iter.rs b/glib/src/variant_iter.rs index a0835dc88a06..f98616d54dc2 100644 --- a/glib/src/variant_iter.rs +++ b/glib/src/variant_iter.rs @@ -196,9 +196,9 @@ impl<'a> DoubleEndedIterator for VariantStrIter<'a> { } } -impl<'a> ExactSizeIterator for VariantStrIter<'a> {} +impl ExactSizeIterator for VariantStrIter<'_> {} -impl<'a> FusedIterator for VariantStrIter<'a> {} +impl FusedIterator for VariantStrIter<'_> {} #[cfg(test)] mod tests { diff --git a/glib/src/variant_type.rs b/glib/src/variant_type.rs index 8e846ad67e0d..ee477896bc22 100644 --- a/glib/src/variant_type.rs +++ b/glib/src/variant_type.rs @@ -967,7 +967,7 @@ impl<'a> Iterator for VariantTyIterator<'a> { } } -impl<'a> iter::FusedIterator for VariantTyIterator<'a> {} +impl iter::FusedIterator for VariantTyIterator<'_> {} #[cfg(test)] mod tests { diff --git a/glib/src/wrapper.rs b/glib/src/wrapper.rs index a45b41fa123e..68cf66b691a9 100644 --- a/glib/src/wrapper.rs +++ b/glib/src/wrapper.rs @@ -272,7 +272,6 @@ /// [#shared]: #shared /// [#object]: #object /// [#non-derivable-classes]: #non-derivable-classes - #[macro_export] macro_rules! wrapper { // Boxed diff --git a/pango/src/attr_iterator.rs b/pango/src/attr_iterator.rs index bd8834335c3c..90c75272fc8e 100644 --- a/pango/src/attr_iterator.rs +++ b/pango/src/attr_iterator.rs @@ -12,7 +12,7 @@ pub struct AttrIterator<'list> { list: PhantomData<&'list crate::AttrList>, } -impl<'list> Clone for AttrIterator<'list> { +impl Clone for AttrIterator<'_> { #[inline] fn clone(&self) -> Self { let ptr = unsafe { @@ -25,7 +25,7 @@ impl<'list> Clone for AttrIterator<'list> { } } -impl<'list> Drop for AttrIterator<'list> { +impl Drop for AttrIterator<'_> { #[inline] fn drop(&mut self) { unsafe { @@ -36,14 +36,14 @@ impl<'list> Drop for AttrIterator<'list> { #[cfg(feature = "v1_44")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))] -impl<'list> glib::prelude::StaticType for AttrIterator<'list> { +impl glib::prelude::StaticType for AttrIterator<'_> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_attr_iterator_get_type()) } } } -impl<'list> AttrIterator<'list> { +impl AttrIterator<'_> { #[doc(alias = "pango_attr_iterator_get")] pub fn get(&self, type_: AttrType) -> Option { unsafe { @@ -121,7 +121,7 @@ impl<'list> IntoIterator for AttrIterator<'list> { #[repr(transparent)] pub struct AttrIntoIter<'list>(Option>); -impl<'list> Iterator for AttrIntoIter<'list> { +impl Iterator for AttrIntoIter<'_> { type Item = SList; #[inline] fn next(&mut self) -> Option { @@ -137,7 +137,7 @@ impl<'list> Iterator for AttrIntoIter<'list> { } } -impl<'list> std::iter::FusedIterator for AttrIntoIter<'list> {} +impl std::iter::FusedIterator for AttrIntoIter<'_> {} #[doc(hidden)] impl<'a, 'list> ToGlibPtr<'a, *const ffi::PangoAttrIterator> for AttrIterator<'list> @@ -164,7 +164,7 @@ where } #[doc(hidden)] -impl<'list> FromGlibPtrFull<*mut ffi::PangoAttrIterator> for AttrIterator<'list> { +impl FromGlibPtrFull<*mut ffi::PangoAttrIterator> for AttrIterator<'_> { #[inline] unsafe fn from_glib_full(ptr: *mut ffi::PangoAttrIterator) -> Self { Self { diff --git a/pango/src/glyph_item_iter.rs b/pango/src/glyph_item_iter.rs index 9fbe0bb8ce21..4bf275daf5f3 100644 --- a/pango/src/glyph_item_iter.rs +++ b/pango/src/glyph_item_iter.rs @@ -13,7 +13,7 @@ pub struct GlyphItemIter<'item> { item: PhantomData<&'item GlyphItem>, } -impl<'item> StaticType for GlyphItemIter<'item> { +impl StaticType for GlyphItemIter<'_> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_glyph_item_iter_get_type()) } @@ -132,7 +132,7 @@ impl<'item> IntoIterator for GlyphItemIter<'item> { #[repr(transparent)] pub struct GlyphItemIntoIter<'item>(Option>); -impl<'item> Iterator for GlyphItemIntoIter<'item> { +impl Iterator for GlyphItemIntoIter<'_> { type Item = (i32, i32, i32, i32, i32, i32); fn next(&mut self) -> Option { if let Some(iter) = &mut self.0 { @@ -154,7 +154,7 @@ impl<'item> Iterator for GlyphItemIntoIter<'item> { } } -impl<'item> std::iter::FusedIterator for GlyphItemIntoIter<'item> {} +impl std::iter::FusedIterator for GlyphItemIntoIter<'_> {} #[doc(hidden)] impl<'a, 'item> ToGlibPtr<'a, *const ffi::PangoGlyphItemIter> for GlyphItemIter<'item> diff --git a/pango/src/script_iter.rs b/pango/src/script_iter.rs index d5d7a2e2f203..dcf5c28df359 100644 --- a/pango/src/script_iter.rs +++ b/pango/src/script_iter.rs @@ -14,7 +14,7 @@ pub struct ScriptIter<'text> { #[cfg(feature = "v1_44")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))] -impl<'text> Clone for ScriptIter<'text> { +impl Clone for ScriptIter<'_> { #[inline] fn clone(&self) -> Self { let ptr = unsafe { @@ -30,7 +30,7 @@ impl<'text> Clone for ScriptIter<'text> { } } -impl<'text> Drop for ScriptIter<'text> { +impl Drop for ScriptIter<'_> { #[inline] fn drop(&mut self) { unsafe { @@ -41,7 +41,7 @@ impl<'text> Drop for ScriptIter<'text> { #[cfg(feature = "v1_44")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))] -impl<'text> glib::prelude::StaticType for ScriptIter<'text> { +impl glib::prelude::StaticType for ScriptIter<'_> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_script_iter_get_type()) } @@ -114,7 +114,7 @@ impl<'text> Iterator for ScriptIntoIter<'text> { } } -impl<'text> std::iter::FusedIterator for ScriptIntoIter<'text> {} +impl std::iter::FusedIterator for ScriptIntoIter<'_> {} #[doc(hidden)] impl<'a, 'text> ToGlibPtr<'a, *const ffi::PangoScriptIter> for ScriptIter<'text> @@ -141,7 +141,7 @@ where } #[doc(hidden)] -impl<'text> FromGlibPtrFull<*mut ffi::PangoScriptIter> for ScriptIter<'text> { +impl FromGlibPtrFull<*mut ffi::PangoScriptIter> for ScriptIter<'_> { #[inline] unsafe fn from_glib_full(ptr: *mut ffi::PangoScriptIter) -> Self { Self {