Skip to content

Commit 63e7cfd

Browse files
committed
Satisfy mismatched-lifetime-syntaxes lint (nightly)
See rust-lang/rust#141787
1 parent 9c24c99 commit 63e7cfd

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

src/hook.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> Debug<'a> {
8686
}
8787

8888
/// Corresponds to the `n` what mask.
89-
pub fn names(&self) -> DebugNames {
89+
pub fn names(&self) -> DebugNames<'_> {
9090
unsafe {
9191
#[cfg(not(feature = "luau"))]
9292
mlua_assert!(
@@ -113,7 +113,7 @@ impl<'a> Debug<'a> {
113113
}
114114

115115
/// Corresponds to the `S` what mask.
116-
pub fn source(&self) -> DebugSource {
116+
pub fn source(&self) -> DebugSource<'_> {
117117
unsafe {
118118
#[cfg(not(feature = "luau"))]
119119
mlua_assert!(

src/state.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ impl Lua {
876876
/// not count in the stack).
877877
///
878878
/// [`Debug`]: crate::hook::Debug
879-
pub fn inspect_stack(&self, level: usize) -> Option<Debug> {
879+
pub fn inspect_stack(&self, level: usize) -> Option<Debug<'_>> {
880880
let lua = self.lock();
881881
unsafe {
882882
let mut ar: ffi::lua_Debug = mem::zeroed();
@@ -1955,15 +1955,15 @@ impl Lua {
19551955
/// Panics if the data object of type `T` is currently mutably borrowed. Multiple immutable
19561956
/// reads can be taken out at the same time.
19571957
#[track_caller]
1958-
pub fn app_data_ref<T: 'static>(&self) -> Option<AppDataRef<T>> {
1958+
pub fn app_data_ref<T: 'static>(&self) -> Option<AppDataRef<'_, T>> {
19591959
let guard = self.lock_arc();
19601960
let extra = unsafe { &*guard.extra.get() };
19611961
extra.app_data.borrow(Some(guard))
19621962
}
19631963

19641964
/// Tries to get a reference to an application data object stored by [`Lua::set_app_data`] of
19651965
/// type `T`.
1966-
pub fn try_app_data_ref<T: 'static>(&self) -> StdResult<Option<AppDataRef<T>>, BorrowError> {
1966+
pub fn try_app_data_ref<T: 'static>(&self) -> StdResult<Option<AppDataRef<'_, T>>, BorrowError> {
19671967
let guard = self.lock_arc();
19681968
let extra = unsafe { &*guard.extra.get() };
19691969
extra.app_data.try_borrow(Some(guard))
@@ -1976,15 +1976,15 @@ impl Lua {
19761976
///
19771977
/// Panics if the data object of type `T` is currently borrowed.
19781978
#[track_caller]
1979-
pub fn app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
1979+
pub fn app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<'_, T>> {
19801980
let guard = self.lock_arc();
19811981
let extra = unsafe { &*guard.extra.get() };
19821982
extra.app_data.borrow_mut(Some(guard))
19831983
}
19841984

19851985
/// Tries to get a mutable reference to an application data object stored by
19861986
/// [`Lua::set_app_data`] of type `T`.
1987-
pub fn try_app_data_mut<T: 'static>(&self) -> StdResult<Option<AppDataRefMut<T>>, BorrowMutError> {
1987+
pub fn try_app_data_mut<T: 'static>(&self) -> StdResult<Option<AppDataRefMut<'_, T>>, BorrowMutError> {
19881988
let guard = self.lock_arc();
19891989
let extra = unsafe { &*guard.extra.get() };
19901990
extra.app_data.try_borrow_mut(Some(guard))
@@ -2058,7 +2058,7 @@ impl Lua {
20582058
}
20592059

20602060
#[inline(always)]
2061-
pub(crate) fn lock(&self) -> ReentrantMutexGuard<RawLua> {
2061+
pub(crate) fn lock(&self) -> ReentrantMutexGuard<'_, RawLua> {
20622062
let rawlua = self.raw.lock();
20632063
#[cfg(feature = "luau")]
20642064
if unsafe { (*rawlua.extra.get()).running_gc } {

src/state/raw.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,15 @@ impl RawLua {
316316
/// Private version of [`Lua::app_data_ref`]
317317
#[track_caller]
318318
#[inline]
319-
pub(crate) fn priv_app_data_ref<T: 'static>(&self) -> Option<AppDataRef<T>> {
319+
pub(crate) fn priv_app_data_ref<T: 'static>(&self) -> Option<AppDataRef<'_, T>> {
320320
let extra = unsafe { &*self.extra.get() };
321321
extra.app_data_priv.borrow(None)
322322
}
323323

324324
/// Private version of [`Lua::app_data_mut`]
325325
#[track_caller]
326326
#[inline]
327-
pub(crate) fn priv_app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
327+
pub(crate) fn priv_app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<'_, T>> {
328328
let extra = unsafe { &*self.extra.get() };
329329
extra.app_data_priv.borrow_mut(None)
330330
}

src/string.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl String {
4343
/// # }
4444
/// ```
4545
#[inline]
46-
pub fn to_str(&self) -> Result<BorrowedStr> {
46+
pub fn to_str(&self) -> Result<BorrowedStr<'_>> {
4747
BorrowedStr::try_from(self)
4848
}
4949

@@ -102,12 +102,12 @@ impl String {
102102
/// # }
103103
/// ```
104104
#[inline]
105-
pub fn as_bytes(&self) -> BorrowedBytes {
105+
pub fn as_bytes(&self) -> BorrowedBytes<'_> {
106106
BorrowedBytes::from(self)
107107
}
108108

109109
/// Get the bytes that make up this string, including the trailing nul byte.
110-
pub fn as_bytes_with_nul(&self) -> BorrowedBytes {
110+
pub fn as_bytes_with_nul(&self) -> BorrowedBytes<'_> {
111111
let BorrowedBytes { buf, borrow, _lua } = BorrowedBytes::from(self);
112112
// Include the trailing nul byte (it's always present but excluded by default)
113113
let buf = unsafe { slice::from_raw_parts((*buf).as_ptr(), (*buf).len() + 1) };

src/table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl Table {
613613
/// ```
614614
///
615615
/// [Lua manual]: http://www.lua.org/manual/5.4/manual.html#pdf-next
616-
pub fn pairs<K: FromLua, V: FromLua>(&self) -> TablePairs<K, V> {
616+
pub fn pairs<K: FromLua, V: FromLua>(&self) -> TablePairs<'_, K, V> {
617617
TablePairs {
618618
guard: self.0.lua.lock(),
619619
table: self,
@@ -678,7 +678,7 @@ impl Table {
678678
/// # Ok(())
679679
/// # }
680680
/// ```
681-
pub fn sequence_values<V: FromLua>(&self) -> TableSequence<V> {
681+
pub fn sequence_values<V: FromLua>(&self) -> TableSequence<'_, V> {
682682
TableSequence {
683683
guard: self.0.lua.lock(),
684684
table: self,

src/types/app_data.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl AppData {
4343

4444
#[inline]
4545
#[track_caller]
46-
pub(crate) fn borrow<T: 'static>(&self, guard: Option<LuaGuard>) -> Option<AppDataRef<T>> {
46+
pub(crate) fn borrow<T: 'static>(&self, guard: Option<LuaGuard>) -> Option<AppDataRef<'_, T>> {
4747
match self.try_borrow(guard) {
4848
Ok(data) => data,
4949
Err(err) => panic!("already mutably borrowed: {err:?}"),
@@ -53,7 +53,7 @@ impl AppData {
5353
pub(crate) fn try_borrow<T: 'static>(
5454
&self,
5555
guard: Option<LuaGuard>,
56-
) -> Result<Option<AppDataRef<T>>, BorrowError> {
56+
) -> Result<Option<AppDataRef<'_, T>>, BorrowError> {
5757
let data = unsafe { &*self.container.get() }
5858
.get(&TypeId::of::<T>())
5959
.map(|c| c.try_borrow())
@@ -74,7 +74,7 @@ impl AppData {
7474

7575
#[inline]
7676
#[track_caller]
77-
pub(crate) fn borrow_mut<T: 'static>(&self, guard: Option<LuaGuard>) -> Option<AppDataRefMut<T>> {
77+
pub(crate) fn borrow_mut<T: 'static>(&self, guard: Option<LuaGuard>) -> Option<AppDataRefMut<'_, T>> {
7878
match self.try_borrow_mut(guard) {
7979
Ok(data) => data,
8080
Err(err) => panic!("already borrowed: {err:?}"),
@@ -84,7 +84,7 @@ impl AppData {
8484
pub(crate) fn try_borrow_mut<T: 'static>(
8585
&self,
8686
guard: Option<LuaGuard>,
87-
) -> Result<Option<AppDataRefMut<T>>, BorrowMutError> {
87+
) -> Result<Option<AppDataRefMut<'_, T>>, BorrowMutError> {
8888
let data = unsafe { &*self.container.get() }
8989
.get(&TypeId::of::<T>())
9090
.map(|c| c.try_borrow_mut())

src/userdata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ impl UserDataMetatable {
10081008
/// The pairs are wrapped in a [`Result`], since they are lazily converted to `V` type.
10091009
///
10101010
/// [`Result`]: crate::Result
1011-
pub fn pairs<V: FromLua>(&self) -> UserDataMetatablePairs<V> {
1011+
pub fn pairs<V: FromLua>(&self) -> UserDataMetatablePairs<'_, V> {
10121012
UserDataMetatablePairs(self.0.pairs())
10131013
}
10141014
}

src/value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl Value {
357357
/// If the value is a Lua [`String`], try to convert it to [`BorrowedStr`] or return `None`
358358
/// otherwise.
359359
#[inline]
360-
pub fn as_str(&self) -> Option<BorrowedStr> {
360+
pub fn as_str(&self) -> Option<BorrowedStr<'_>> {
361361
self.as_string().and_then(|s| s.to_str().ok())
362362
}
363363

@@ -484,7 +484,7 @@ impl Value {
484484
#[cfg(feature = "serde")]
485485
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
486486
#[doc(hidden)]
487-
pub fn to_serializable(&self) -> SerializableValue {
487+
pub fn to_serializable(&self) -> SerializableValue<'_> {
488488
SerializableValue::new(self, Default::default(), None)
489489
}
490490

0 commit comments

Comments
 (0)