Skip to content

Commit ad487aa

Browse files
committed
Fix new nightly warning about confusing lifetime flows
1 parent 02baaed commit ad487aa

File tree

18 files changed

+45
-41
lines changed

18 files changed

+45
-41
lines changed

cairo/src/device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Device {
159159
}
160160

161161
#[doc(alias = "cairo_device_acquire")]
162-
pub fn acquire(&self) -> Result<DeviceAcquireGuard, Error> {
162+
pub fn acquire(&self) -> Result<DeviceAcquireGuard<'_>, Error> {
163163
unsafe {
164164
let status = ffi::cairo_device_acquire(self.to_raw_none());
165165
status_to_result(status)?;

cairo/src/image_surface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl ImageSurface {
8484

8585
#[doc(alias = "cairo_image_surface_get_data")]
8686
#[doc(alias = "get_data")]
87-
pub fn data(&mut self) -> Result<ImageSurfaceData, BorrowError> {
87+
pub fn data(&mut self) -> Result<ImageSurfaceData<'_>, BorrowError> {
8888
unsafe {
8989
if ffi::cairo_surface_get_reference_count(self.to_raw_none()) > 1 {
9090
return Err(BorrowError::NonExclusive);

cairo/src/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Path {
2020
Path(ptr::NonNull::new_unchecked(pointer))
2121
}
2222

23-
pub fn iter(&self) -> PathSegments {
23+
pub fn iter(&self) -> PathSegments<'_> {
2424
use std::slice;
2525

2626
unsafe {

gio/src/list_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait ListModelExtManual: sealed::Sealed + IsA<ListModel> + Sized {
3131
/// # Panics
3232
///
3333
/// Panics if `T::static_type().is_a(self.item_type())` is not true.
34-
fn iter<LT: IsA<glib::Object>>(&self) -> ListModelIter<LT> {
34+
fn iter<LT: IsA<glib::Object>>(&self) -> ListModelIter<'_, LT> {
3535
assert!(self.item_type().is_a(LT::static_type()));
3636

3737
let len = self.n_items();

gio/src/unix_socket_address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod sealed {
7373
pub trait UnixSocketAddressExtManual: sealed::Sealed + IsA<UnixSocketAddress> + 'static {
7474
#[doc(alias = "g_unix_socket_address_get_path")]
7575
#[doc(alias = "get_path")]
76-
fn path(&self) -> Option<UnixSocketAddressPath> {
76+
fn path(&self) -> Option<UnixSocketAddressPath<'_>> {
7777
use self::UnixSocketAddressPath::*;
7878

7979
let path = unsafe {

glib/src/collections/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ impl<T: TransparentPtrType> List<T> {
101101
// rustdoc-stripper-ignore-next
102102
/// Create a non-destructive iterator over the `List`.
103103
#[inline]
104-
pub fn iter(&self) -> Iter<T> {
104+
pub fn iter(&self) -> Iter<'_, T> {
105105
Iter::new(self)
106106
}
107107

108108
// rustdoc-stripper-ignore-next
109109
/// Create a non-destructive mutable iterator over the `List`.
110110
#[inline]
111-
pub fn iter_mut(&mut self) -> IterMut<T> {
111+
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
112112
IterMut::new(self)
113113
}
114114

glib/src/collections/slist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ impl<T: TransparentPtrType> SList<T> {
101101
// rustdoc-stripper-ignore-next
102102
/// Create a non-destructive iterator over the `SList`.
103103
#[inline]
104-
pub fn iter(&self) -> Iter<T> {
104+
pub fn iter(&self) -> Iter<'_, T> {
105105
Iter::new(self)
106106
}
107107

108108
// rustdoc-stripper-ignore-next
109109
/// Create a non-destructive mutable iterator over the `SList`.
110110
#[inline]
111-
pub fn iter_mut(&mut self) -> IterMut<T> {
111+
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
112112
IterMut::new(self)
113113
}
114114

glib/src/enums.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,14 +748,14 @@ impl FlagsClass {
748748
// rustdoc-stripper-ignore-next
749749
/// Returns a new `FlagsBuilder` for conveniently setting/unsetting flags
750750
/// and building a `Value`.
751-
pub fn builder(&self) -> FlagsBuilder {
751+
pub fn builder(&self) -> FlagsBuilder<'_> {
752752
FlagsBuilder::new(self)
753753
}
754754

755755
// rustdoc-stripper-ignore-next
756756
/// Returns a new `FlagsBuilder` for conveniently setting/unsetting flags
757757
/// and building a `Value`. The `Value` is initialized with `value`.
758-
pub fn builder_with_value(&self, value: Value) -> Option<FlagsBuilder> {
758+
pub fn builder_with_value(&self, value: Value) -> Option<FlagsBuilder<'_>> {
759759
if self.type_() != value.type_() {
760760
return None;
761761
}
@@ -966,12 +966,12 @@ pub type FlagsValues = EnumerationValues<FlagsValue>;
966966
#[must_use = "The builder must be built to be used"]
967967
pub struct FlagsBuilder<'a>(&'a FlagsClass, Option<Value>);
968968
impl FlagsBuilder<'_> {
969-
fn new(flags_class: &FlagsClass) -> FlagsBuilder {
969+
fn new(flags_class: &FlagsClass) -> FlagsBuilder<'_> {
970970
let value = unsafe { Value::from_type_unchecked(flags_class.type_()) };
971971
FlagsBuilder(flags_class, Some(value))
972972
}
973973

974-
fn with_value(flags_class: &FlagsClass, value: Value) -> FlagsBuilder {
974+
fn with_value(flags_class: &FlagsClass, value: Value) -> FlagsBuilder<'_> {
975975
FlagsBuilder(flags_class, Some(value))
976976
}
977977

glib/src/main_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl MainContext {
161161
///
162162
/// This will fail if the main context is owned already by another thread.
163163
#[doc(alias = "g_main_context_acquire")]
164-
pub fn acquire(&self) -> Result<MainContextAcquireGuard, crate::BoolError> {
164+
pub fn acquire(&self) -> Result<MainContextAcquireGuard<'_>, crate::BoolError> {
165165
unsafe {
166166
let ret: bool = from_glib(ffi::g_main_context_acquire(self.to_glib_none().0));
167167
if ret {
@@ -189,7 +189,7 @@ impl Drop for MainContextAcquireGuard<'_> {
189189
struct ThreadDefaultContext<'a>(&'a MainContext);
190190

191191
impl ThreadDefaultContext<'_> {
192-
fn new(ctx: &MainContext) -> ThreadDefaultContext {
192+
fn new(ctx: &MainContext) -> ThreadDefaultContext<'_> {
193193
unsafe {
194194
ffi::g_main_context_push_thread_default(ctx.to_glib_none().0);
195195
}

glib/src/object.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ pub trait ObjectExt: ObjectType {
16831683
///
16841684
/// `None` is returned if the object does not implement the interface `T`.
16851685
#[doc(alias = "get_interface")]
1686-
fn interface<T: IsInterface>(&self) -> Option<InterfaceRef<T>>;
1686+
fn interface<T: IsInterface>(&self) -> Option<InterfaceRef<'_, T>>;
16871687

16881688
// rustdoc-stripper-ignore-next
16891689
/// Sets the property `property_name` of the object to value `value`.
@@ -2300,7 +2300,7 @@ impl<T: ObjectType> ObjectExt for T {
23002300
}
23012301

23022302
#[inline]
2303-
fn interface<U: IsInterface>(&self) -> Option<InterfaceRef<U>> {
2303+
fn interface<U: IsInterface>(&self) -> Option<InterfaceRef<'_, U>> {
23042304
Interface::from_class(self.object_class())
23052305
}
23062306

@@ -4032,7 +4032,7 @@ impl<T: IsClass> Class<T> {
40324032
/// Gets the parent class struct, if any.
40334033
#[doc(alias = "g_type_class_peek_parent")]
40344034
#[inline]
4035-
pub fn parent(&self) -> Option<ClassRef<T>> {
4035+
pub fn parent(&self) -> Option<ClassRef<'_, T>> {
40364036
unsafe {
40374037
let ptr = gobject_ffi::g_type_class_peek_parent(&self.0 as *const _ as *mut _);
40384038
if ptr.is_null() {
@@ -4171,7 +4171,7 @@ impl<T: IsInterface> Interface<T> {
41714171
///
41724172
/// This will return `None` if `klass` is not implementing `Self`.
41734173
#[inline]
4174-
pub fn from_class<U: IsClass>(klass: &Class<U>) -> Option<InterfaceRef<T>> {
4174+
pub fn from_class<U: IsClass>(klass: &Class<U>) -> Option<InterfaceRef<'_, T>> {
41754175
if !klass.type_().is_a(T::static_type()) {
41764176
return None;
41774177
}
@@ -4241,7 +4241,7 @@ impl<T: IsInterface> Interface<T> {
42414241
/// interface.
42424242
#[doc(alias = "g_type_interface_peek_parent")]
42434243
#[inline]
4244-
pub fn parent(&self) -> Option<InterfaceRef<T>> {
4244+
pub fn parent(&self) -> Option<InterfaceRef<'_, T>> {
42454245
unsafe {
42464246
let ptr = gobject_ffi::g_type_interface_peek_parent(&self.0 as *const _ as *mut _);
42474247
if ptr.is_null() {

0 commit comments

Comments
 (0)