Skip to content

Commit

Permalink
Elide redundant impl block lifetimes following stricter Rust 1.83 lint
Browse files Browse the repository at this point in the history
Rust now points out that `impl<'a> (Trait for) Struct<'a>` is
superfluous whenever `'a` is not used anywhere else in the `impl` block.
  • Loading branch information
MarijnS95 committed Jan 27, 2025
1 parent 7a4554c commit da4bd95
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions android-activity/src/game_activity/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ pub(crate) struct PointerImpl<'a> {
index: usize,
}

impl<'a> PointerImpl<'a> {
impl PointerImpl<'_> {
#[inline]
pub fn pointer_index(&self) -> usize {
self.index
Expand Down Expand Up @@ -333,7 +333,7 @@ impl<'a> Iterator for PointersIterImpl<'a> {
}
}

impl<'a> ExactSizeIterator for PointersIterImpl<'a> {
impl ExactSizeIterator for PointersIterImpl<'_> {
fn len(&self) -> usize {
self.count - self.next_index
}
Expand Down Expand Up @@ -740,7 +740,7 @@ impl<'a> KeyEvent<'a> {
}
}

impl<'a> KeyEvent<'a> {
impl KeyEvent<'_> {
/// Flags associated with this [`KeyEvent`].
///
/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getflags)
Expand Down
8 changes: 4 additions & 4 deletions android-activity/src/game_activity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a> StateSaver<'a> {
pub struct StateLoader<'a> {
app: &'a AndroidAppInner,
}
impl<'a> StateLoader<'a> {
impl StateLoader<'_> {
pub fn load(&self) -> Option<Vec<u8>> {
unsafe {
let app_ptr = self.app.native_app.as_ptr();
Expand Down Expand Up @@ -722,7 +722,7 @@ impl<'a> InputBuffer<'a> {
}
}

impl<'a> Drop for InputBuffer<'a> {
impl Drop for InputBuffer<'_> {
fn drop(&mut self) {
unsafe {
ffi::android_app_clear_motion_events(self.ptr.as_ptr());
Expand Down Expand Up @@ -801,7 +801,7 @@ pub(crate) struct InputIteratorInner<'a> {
text_event_checked: bool,
}

impl<'a> InputIteratorInner<'a> {
impl InputIteratorInner<'_> {
pub(crate) fn next<F>(&mut self, callback: F) -> bool
where
F: FnOnce(&input::InputEvent) -> InputStatus,
Expand Down Expand Up @@ -943,7 +943,7 @@ pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) {
// code to look up non-standard Java classes.
android_main(app);
})
.unwrap_or_else(|panic| log_panic(panic));
.unwrap_or_else(log_panic);

// Let JVM know that our Activity can be destroyed before detaching from the JVM
//
Expand Down
6 changes: 3 additions & 3 deletions android-activity/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ pub struct InputIterator<'a> {
pub(crate) inner: crate::activity_impl::InputIteratorInner<'a>,
}

impl<'a> InputIterator<'a> {
impl InputIterator<'_> {
/// Reads and handles the next input event by passing it to the given `callback`
///
/// `callback` should return [`InputStatus::Unhandled`] for any input events that aren't directly
Expand All @@ -932,7 +932,7 @@ pub struct Pointer<'a> {
pub(crate) inner: PointerImpl<'a>,
}

impl<'a> Pointer<'a> {
impl Pointer<'_> {
#[inline]
pub fn pointer_index(&self) -> usize {
self.inner.pointer_index()
Expand Down Expand Up @@ -1026,7 +1026,7 @@ impl<'a> Iterator for PointersIter<'a> {
}
}

impl<'a> ExactSizeIterator for PointersIter<'a> {
impl ExactSizeIterator for PointersIter<'_> {
fn len(&self) -> usize {
self.inner.len()
}
Expand Down
8 changes: 4 additions & 4 deletions android-activity/src/native_activity/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct MotionEvent<'a> {
ndk_event: ndk::event::MotionEvent,
_lifetime: PhantomData<&'a ndk::event::MotionEvent>,
}
impl<'a> MotionEvent<'a> {
impl MotionEvent<'_> {
pub(crate) fn new(ndk_event: ndk::event::MotionEvent) -> Self {
Self {
ndk_event,
Expand Down Expand Up @@ -248,7 +248,7 @@ pub(crate) struct PointerImpl<'a> {
ndk_pointer: ndk::event::Pointer<'a>,
}

impl<'a> PointerImpl<'a> {
impl PointerImpl<'_> {
#[inline]
pub fn pointer_index(&self) -> usize {
self.ndk_pointer.pointer_index()
Expand Down Expand Up @@ -303,7 +303,7 @@ impl<'a> Iterator for PointersIterImpl<'a> {
}
}

impl<'a> ExactSizeIterator for PointersIterImpl<'a> {
impl ExactSizeIterator for PointersIterImpl<'_> {
fn len(&self) -> usize {
self.ndk_pointers_iter.len()
}
Expand All @@ -319,7 +319,7 @@ pub struct KeyEvent<'a> {
ndk_event: ndk::event::KeyEvent,
_lifetime: PhantomData<&'a ndk::event::KeyEvent>,
}
impl<'a> KeyEvent<'a> {
impl KeyEvent<'_> {
pub(crate) fn new(ndk_event: ndk::event::KeyEvent) -> Self {
Self {
ndk_event,
Expand Down
6 changes: 3 additions & 3 deletions android-activity/src/native_activity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'a> StateSaver<'a> {
pub struct StateLoader<'a> {
app: &'a AndroidAppInner,
}
impl<'a> StateLoader<'a> {
impl StateLoader<'_> {
/// Returns whatever state was saved during the last [MainEvent::SaveState] event or `None`
pub fn load(&self) -> Option<Vec<u8>> {
self.app.native_activity.saved_state()
Expand Down Expand Up @@ -465,7 +465,7 @@ pub(crate) struct InputReceiver {
queue: Option<InputQueue>,
}

impl<'a> From<Arc<InputReceiver>> for InputIteratorInner<'a> {
impl From<Arc<InputReceiver>> for InputIteratorInner<'_> {
fn from(receiver: Arc<InputReceiver>) -> Self {
Self {
receiver,
Expand All @@ -480,7 +480,7 @@ pub(crate) struct InputIteratorInner<'a> {
_lifetime: PhantomData<&'a ()>,
}

impl<'a> InputIteratorInner<'a> {
impl InputIteratorInner<'_> {
pub(crate) fn next<F>(&self, callback: F) -> bool
where
F: FnOnce(&input::InputEvent) -> InputStatus,
Expand Down

0 comments on commit da4bd95

Please sign in to comment.