Skip to content

Commit

Permalink
Clippy wants us to elide lifetimes (#780)
Browse files Browse the repository at this point in the history
Fixed with cargo clippy --fix

- [x] no changelog update needed
  • Loading branch information
gwilymk authored Oct 5, 2024
2 parents 04e44eb + d109f01 commit ebfe851
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion agb-debug/src/gwilym_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'a> GwilymDecodeIter<'a> {
}
}

impl<'a> Iterator for GwilymDecodeIter<'a> {
impl Iterator for GwilymDecodeIter<'_> {
type Item = u32;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion agb-hashmap/src/hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl<'a, K, ALLOCATOR: ClonableAllocator> Iterator for Iter<'a, K, ALLOCATOR> {
}
}

impl<'a, K, ALLOCATOR: ClonableAllocator> ExactSizeIterator for Iter<'a, K, ALLOCATOR> {}
impl<K, ALLOCATOR: ClonableAllocator> ExactSizeIterator for Iter<'_, K, ALLOCATOR> {}

impl<K> FromIterator<K> for HashSet<K>
where
Expand Down
2 changes: 1 addition & 1 deletion agb-hashmap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ impl<'a, K, V, ALLOCATOR: ClonableAllocator> Iterator for Iter<'a, K, V, ALLOCAT
}
}

impl<'a, K, V, ALLOCATOR: ClonableAllocator> ExactSizeIterator for Iter<'a, K, V, ALLOCATOR> {}
impl<K, V, ALLOCATOR: ClonableAllocator> ExactSizeIterator for Iter<'_, K, V, ALLOCATOR> {}

impl<'a, K, V, ALLOCATOR: ClonableAllocator> IntoIterator for &'a HashMap<K, V, ALLOCATOR> {
type Item = (&'a K, &'a V);
Expand Down
2 changes: 1 addition & 1 deletion agb/src/display/blend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct BlendLayer<'blend, 'gba> {
layer: Layer,
}

impl<'gba> BlendLayer<'_, 'gba> {
impl BlendLayer<'_, '_> {
/// Set whether a background is enabled for blending on this layer.
pub fn set_background_enable(&mut self, background: BackgroundID, enable: bool) -> &mut Self {
self.blend
Expand Down
4 changes: 2 additions & 2 deletions agb/src/display/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub struct TextWriter<'a, 'b> {
bg: &'a mut RegularMap,
}

impl<'a, 'b> Write for TextWriter<'a, 'b> {
impl Write for TextWriter<'_, '_> {
fn write_str(&mut self, text: &str) -> Result<(), Error> {
for c in text.chars() {
self.text_renderer.write_char(
Expand All @@ -150,7 +150,7 @@ impl<'a, 'b> Write for TextWriter<'a, 'b> {
}
}

impl<'a, 'b> TextWriter<'a, 'b> {
impl TextWriter<'_, '_> {
pub fn commit(self) {
self.text_renderer.commit(self.bg, self.vram_manager);
}
Expand Down
2 changes: 1 addition & 1 deletion agb/src/display/object/font/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Line {
}
}

impl<'pre> Iterator for Lines<'pre> {
impl Iterator for Lines<'_> {
type Item = Line;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion agb/src/display/object/unmanaged/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct OamIterator<'oam> {
frame_data: &'oam UnsafeCell<OamFrameModifyables>,
}

impl<'oam> OamIterator<'oam> {
impl OamIterator<'_> {
/// Sets the next oam slot with the provided `object`.
///
/// Is equivalent to the following:
Expand Down
6 changes: 3 additions & 3 deletions agb/src/display/tiled/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,15 @@ pub struct MapLoan<'a, T> {
screenblock_list: &'a RefCell<Bitarray<1>>,
}

impl<'a, T> Deref for MapLoan<'a, T> {
impl<T> Deref for MapLoan<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
&self.map
}
}

impl<'a, T> DerefMut for MapLoan<'a, T> {
impl<T> DerefMut for MapLoan<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.map
}
Expand Down Expand Up @@ -526,7 +526,7 @@ impl<'a, T> MapLoan<'a, T> {
}
}

impl<'a, T> Drop for MapLoan<'a, T> {
impl<T> Drop for MapLoan<'_, T> {
fn drop(&mut self) {
self.map_list
.borrow_mut()
Expand Down
2 changes: 1 addition & 1 deletion agb/src/display/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum WinIn {
Win1,
}

impl<'gba> Windows<'gba> {
impl Windows<'_> {
pub(crate) fn new() -> Self {
let s = Self {
wins: [MovableWindow::new(0), MovableWindow::new(1)],
Expand Down
6 changes: 3 additions & 3 deletions agb/src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct Dmas<'gba> {
pub dma3: Dma,
}

impl<'gba> Dmas<'gba> {
impl Dmas<'_> {
unsafe fn new() -> Self {
Self {
phantom: PhantomData,
Expand Down Expand Up @@ -137,7 +137,7 @@ where
phantom: PhantomData<&'a ()>,
}

impl<'a, T> DmaTransferHandle<'a, T>
impl<T> DmaTransferHandle<'_, T>
where
T: Copy,
{
Expand All @@ -150,7 +150,7 @@ where
}
}

impl<'a, T> Drop for DmaTransferHandle<'a, T>
impl<T> Drop for DmaTransferHandle<'_, T>
where
T: Copy,
{
Expand Down
2 changes: 1 addition & 1 deletion agb/src/panics_render/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<'bitmap, 'gba> BitmapTextRender<'bitmap, 'gba> {
}
}

impl<'bitmap, 'gba> Write for BitmapTextRender<'bitmap, 'gba> {
impl Write for BitmapTextRender<'_, '_> {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
for c in s.chars() {
self.render_char(c);
Expand Down
2 changes: 1 addition & 1 deletion agb/src/save/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub struct SavePreparedBlock<'a> {
parent: &'a mut SaveData,
range: Range<usize>,
}
impl<'a> SavePreparedBlock<'a> {
impl SavePreparedBlock<'_> {
/// Writes a given buffer into the save media.
///
/// Multiple overlapping writes to the same memory range without a separate
Expand Down
8 changes: 4 additions & 4 deletions agb/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ unsafe impl Sync for RawLock {}

/// A guard representing an active lock on an [`RawLock`].
pub struct RawLockGuard<'a>(&'a RawLock);
impl<'a> Drop for RawLockGuard<'a> {
impl Drop for RawLockGuard<'_> {
fn drop(&mut self) {
self.0.raw_unlock();
}
Expand Down Expand Up @@ -103,18 +103,18 @@ pub struct LockGuard<'a, T> {
underlying: &'a Lock<T>,
ptr: *mut T,
}
impl<'a, T> Drop for LockGuard<'a, T> {
impl<T> Drop for LockGuard<'_, T> {
fn drop(&mut self) {
self.underlying.raw.raw_unlock();
}
}
impl<'a, T> Deref for LockGuard<'a, T> {
impl<T> Deref for LockGuard<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
unsafe { &*self.ptr }
}
}
impl<'a, T> DerefMut for LockGuard<'a, T> {
impl<T> DerefMut for LockGuard<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { &mut *self.ptr }
}
Expand Down
2 changes: 1 addition & 1 deletion examples/the-dungeon-puzzlers-lament/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Construction<'a, 'b> {
background: &'a mut MapLoan<'b, RegularMap>,
}

impl<'a, 'b> Drop for Construction<'a, 'b> {
impl Drop for Construction<'_, '_> {
fn drop(&mut self) {
self.background.set_visible(false);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/the-hat-chooses-the-wizard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ struct Map<'a, 'b> {
level: &'a Level,
}

impl<'a, 'b> Map<'a, 'b> {
impl Map<'_, '_> {
pub fn commit_position(&mut self, vram: &mut VRamManager) {
self.background.set_pos(vram, self.position.floor());
self.foreground.set_pos(vram, self.position.floor());
Expand Down
2 changes: 1 addition & 1 deletion tracker/agb-tracker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl SoundChannel for agb::sound::mixer::SoundChannel {
}

#[cfg(feature = "agb")]
impl<'gba> Mixer for agb::sound::mixer::Mixer<'gba> {
impl Mixer for agb::sound::mixer::Mixer<'_> {
type ChannelId = agb::sound::mixer::ChannelId;
type SoundChannel = agb::sound::mixer::SoundChannel;

Expand Down

0 comments on commit ebfe851

Please sign in to comment.