From 6fb7b74b35abd50246c0aa855ae62bc0c12d0928 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 4 Jul 2023 20:10:01 +0100 Subject: [PATCH 1/3] Fix clippy lints from 04/07/2023 --- agb/src/agb_alloc/mod.rs | 2 +- agb/src/agbabi/mod.rs | 2 +- agb/src/display/object/unmanaged/object.rs | 4 ++-- agb/src/display/tiled/mod.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agb/src/agb_alloc/mod.rs b/agb/src/agb_alloc/mod.rs index 8968fd5f..bcbc8bd3 100644 --- a/agb/src/agb_alloc/mod.rs +++ b/agb/src/agb_alloc/mod.rs @@ -14,7 +14,7 @@ unsafe impl Send for SendNonNull {} impl Clone for SendNonNull { fn clone(&self) -> Self { - SendNonNull(self.0) + *self } } impl Copy for SendNonNull {} diff --git a/agb/src/agbabi/mod.rs b/agb/src/agbabi/mod.rs index bfd4a385..a53823cf 100644 --- a/agb/src/agbabi/mod.rs +++ b/agb/src/agbabi/mod.rs @@ -154,7 +154,7 @@ mod test { #[test_case] fn test_all_of_memcpy(_gba: &mut Gba) { - let mut input = vec![0u8; 100]; + let mut input = [0u8; 100]; let mut output = vec![0u8; 100]; for size in 0..80 { diff --git a/agb/src/display/object/unmanaged/object.rs b/agb/src/display/object/unmanaged/object.rs index fb5a42ef..8d65e31a 100644 --- a/agb/src/display/object/unmanaged/object.rs +++ b/agb/src/display/object/unmanaged/object.rs @@ -110,7 +110,7 @@ impl OamSlot<'_> { if let Some(affine_matrix) = &object.affine_matrix { Self::handle_affine(&mut attributes, frame_data, affine_matrix); } - attributes.write(unsafe { (OBJECT_ATTRIBUTE_MEMORY as *mut u16).add(self.slot * 4) }); + attributes.write(unsafe { OBJECT_ATTRIBUTE_MEMORY.add(self.slot * 4) }); frame_data.this_frame_sprites.push(object.sprite.clone()); } @@ -160,7 +160,7 @@ impl Drop for OamIterator<'_> { for idx in number_writen..*last_frame_written { unsafe { - let ptr = (OBJECT_ATTRIBUTE_MEMORY as *mut u16).add(idx * 4); + let ptr = OBJECT_ATTRIBUTE_MEMORY.add(idx * 4); ptr.write_volatile(0b10 << 8); } } diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index c04d812b..ff88552e 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -189,7 +189,7 @@ impl TileSetting { } } -pub(self) fn find_screenblock_gap(screenblocks: &Bitarray<1>, gap: usize) -> usize { + fn find_screenblock_gap(screenblocks: &Bitarray<1>, gap: usize) -> usize { let mut candidate = 0; 'outer: while candidate < 16 - gap { From 14c6542e7b7c22bd35edd21a63c0f65d6a49b7fe Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 4 Jul 2023 20:37:26 +0100 Subject: [PATCH 2/3] Clippy fix didn't delete a space --- agb/src/display/tiled/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index ff88552e..7248e380 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -189,7 +189,7 @@ impl TileSetting { } } - fn find_screenblock_gap(screenblocks: &Bitarray<1>, gap: usize) -> usize { +fn find_screenblock_gap(screenblocks: &Bitarray<1>, gap: usize) -> usize { let mut candidate = 0; 'outer: while candidate < 16 - gap { From 284e30078f478f502805380eca577f27cf7587c0 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 4 Jul 2023 21:24:44 +0100 Subject: [PATCH 3/3] Fix clippy lint in purple night --- examples/the-purple-night/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/the-purple-night/src/lib.rs b/examples/the-purple-night/src/lib.rs index ea667825..754216df 100644 --- a/examples/the-purple-night/src/lib.rs +++ b/examples/the-purple-night/src/lib.rs @@ -1002,7 +1002,7 @@ impl SlimeData { entity.sprite.set_sprite(sprite); entity.velocity.x = match frame { - 2 | 3 | 4 => (Number::new(1) / 5) * Number::new(*direction as i32), + 2..=4 => (Number::new(1) / 5) * Number::new(*direction as i32), _ => 0.into(), };