From 45a7447da99c0260508eadb93e54ce6ca680966a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Tue, 6 Dec 2022 14:45:21 +0000
Subject: [PATCH] fix: clippy warnings

---
 src/mmu.rs | 15 +++++++--------
 src/ppu.rs |  5 ++++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mmu.rs b/src/mmu.rs
index 653cb7f2..2f277fbb 100644
--- a/src/mmu.rs
+++ b/src/mmu.rs
@@ -128,7 +128,9 @@ impl Mmu {
                 0xe00 => self.ppu.read(addr),
                 0xf00 => match addr & 0x00ff {
                     // 0xFF0F — IF: Interrupt flag
-                    0x0f => {
+                    0x0f =>
+                    {
+                        #[allow(clippy::bool_to_int_with_if)]
                         (if self.ppu.int_vblank() { 0x01 } else { 0x00 }
                             | if self.ppu.int_stat() { 0x02 } else { 0x00 }
                             | if self.timer.int_tima() { 0x04 } else { 0x00 }
@@ -136,13 +138,7 @@ impl Mmu {
                     }
 
                     // 0xFF50 - Boot active flag
-                    0x50 => {
-                        if self.boot_active {
-                            0x01
-                        } else {
-                            0x00
-                        }
-                    }
+                    0x50 => u8::from(self.boot_active),
 
                     // 0xFF80-0xFFFE - High RAM (HRAM)
                     0x80..=0xfe => self.ppu.read(addr),
@@ -249,6 +245,9 @@ impl Mmu {
                                 // 0xFF51-0xFF52 - VRAM DMA source (CGB only)
                                 0x51..=0x52 => (),
 
+                                // 0xFF53-0xFF54 - VRAM DMA destination (CGB only)
+                                0x53..=0x54 => (),
+
                                 _ => debugln!("Writing to unknown IO control 0x{:04x}", addr),
                             },
                             _ => debugln!("Writing to unknown IO control 0x{:04x}", addr),
diff --git a/src/ppu.rs b/src/ppu.rs
index 7e467cde..2272130a 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -471,7 +471,9 @@ impl Ppu {
             0x8000..=0x9fff => self.vram[(addr & 0x1fff) as usize],
             0xfe00..=0xfe9f => self.oam[(addr & 0x009f) as usize],
             0xff80..=0xfffe => self.hram[(addr & 0x007f) as usize],
-            0xff40 => {
+            0xff40 =>
+            {
+                #[allow(clippy::bool_to_int_with_if)]
                 (if self.switch_bg { 0x01 } else { 0x00 }
                     | if self.switch_obj { 0x02 } else { 0x00 }
                     | if self.obj_size { 0x04 } else { 0x00 }
@@ -675,6 +677,7 @@ impl Ppu {
 
         for x in 0..TILE_WIDTH {
             mask = 1 << (7 - x);
+            #[allow(clippy::bool_to_int_with_if)]
             tile.set(
                 x,
                 y,
-- 
GitLab