Skip to content

Commit c9e4122

Browse files
sdroegebilelmoussaoui
authored andcommitted
Fix new nightly warning about confusing lifetime flows
1 parent 611dc0d commit c9e4122

File tree

18 files changed

+45
-40
lines changed

18 files changed

+45
-40
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
@@ -26,7 +26,7 @@ pub trait ListModelExtManual: IsA<ListModel> + Sized {
2626
/// # Panics
2727
///
2828
/// Panics if `T::static_type().is_a(self.item_type())` is not true.
29-
fn iter<LT: IsA<glib::Object>>(&self) -> ListModelIter<LT> {
29+
fn iter<LT: IsA<glib::Object>>(&self) -> ListModelIter<'_, LT> {
3030
assert!(self.item_type().is_a(LT::static_type()));
3131

3232
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
@@ -68,7 +68,7 @@ impl UnixSocketAddress {
6868
pub trait UnixSocketAddressExtManual: IsA<UnixSocketAddress> + 'static {
6969
#[doc(alias = "g_unix_socket_address_get_path")]
7070
#[doc(alias = "get_path")]
71-
fn path(&self) -> Option<UnixSocketAddressPath> {
71+
fn path(&self) -> Option<UnixSocketAddressPath<'_>> {
7272
use self::UnixSocketAddressPath::*;
7373

7474
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
@@ -1688,7 +1688,7 @@ pub trait ObjectExt: ObjectType {
16881688
///
16891689
/// `None` is returned if the object does not implement the interface `T`.
16901690
#[doc(alias = "get_interface")]
1691-
fn interface<T: IsInterface>(&self) -> Option<InterfaceRef<T>>;
1691+
fn interface<T: IsInterface>(&self) -> Option<InterfaceRef<'_, T>>;
16921692

16931693
// rustdoc-stripper-ignore-next
16941694
/// Sets the property `property_name` of the object to value `value`.
@@ -2307,7 +2307,7 @@ impl<T: ObjectType> ObjectExt for T {
23072307
}
23082308

23092309
#[inline]
2310-
fn interface<U: IsInterface>(&self) -> Option<InterfaceRef<U>> {
2310+
fn interface<U: IsInterface>(&self) -> Option<InterfaceRef<'_, U>> {
23112311
Interface::from_class(self.object_class())
23122312
}
23132313

@@ -4037,7 +4037,7 @@ impl<T: IsClass> Class<T> {
40374037
/// Gets the parent class struct, if any.
40384038
#[doc(alias = "g_type_class_peek_parent")]
40394039
#[inline]
4040-
pub fn parent(&self) -> Option<ClassRef<T>> {
4040+
pub fn parent(&self) -> Option<ClassRef<'_, T>> {
40414041
unsafe {
40424042
let ptr = gobject_ffi::g_type_class_peek_parent(&self.0 as *const _ as *mut _);
40434043
if ptr.is_null() {
@@ -4176,7 +4176,7 @@ impl<T: IsInterface> Interface<T> {
41764176
///
41774177
/// This will return `None` if `klass` is not implementing `Self`.
41784178
#[inline]
4179-
pub fn from_class<U: IsClass>(klass: &Class<U>) -> Option<InterfaceRef<T>> {
4179+
pub fn from_class<U: IsClass>(klass: &Class<U>) -> Option<InterfaceRef<'_, T>> {
41804180
if !klass.type_().is_a(T::static_type()) {
41814181
return None;
41824182
}
@@ -4246,7 +4246,7 @@ impl<T: IsInterface> Interface<T> {
42464246
/// interface.
42474247
#[doc(alias = "g_type_interface_peek_parent")]
42484248
#[inline]
4249-
pub fn parent(&self) -> Option<InterfaceRef<T>> {
4249+
pub fn parent(&self) -> Option<InterfaceRef<'_, T>> {
42504250
unsafe {
42514251
let ptr = gobject_ffi::g_type_interface_peek_parent(&self.0 as *const _ as *mut _);
42524252
if ptr.is_null() {

0 commit comments

Comments
 (0)