From f90c50ef1d0e6ca7f32017f541c49fa0a2cecd7d Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Thu, 18 May 2023 10:32:54 +1000 Subject: [PATCH] clippy --- lib/src/processor/memory/rom/mbcs/mbc3.rs | 6 +----- lib/src/processor/memory/rom/mbcs/mbc5.rs | 6 +----- lib/src/processor/memory/rom/mbcs/pocketcamera.rs | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/src/processor/memory/rom/mbcs/mbc3.rs b/lib/src/processor/memory/rom/mbcs/mbc3.rs index a868364..9176d83 100644 --- a/lib/src/processor/memory/rom/mbcs/mbc3.rs +++ b/lib/src/processor/memory/rom/mbcs/mbc3.rs @@ -182,11 +182,7 @@ impl Mbc for Mbc3 { rtc.latched_time = Some(Instant::now()); } - if data == 0x00 { - rtc.latch_prepared = true; - } else { - rtc.latch_prepared = false; - } + rtc.latch_prepared = data == 0x00; } } _ => panic!("unsupported addr"), diff --git a/lib/src/processor/memory/rom/mbcs/mbc5.rs b/lib/src/processor/memory/rom/mbcs/mbc5.rs index 3749c91..1631988 100644 --- a/lib/src/processor/memory/rom/mbcs/mbc5.rs +++ b/lib/src/processor/memory/rom/mbcs/mbc5.rs @@ -73,11 +73,7 @@ impl Mbc for Mbc5 { fn set(&mut self, address: RomAddress, data: u8) { match address.inner() { 0x0..0x2000 => { - if (data & 0xF) == 0xA { - self.ram_enabled = true - } else { - self.ram_enabled = false - } + self.ram_enabled = (data & 0xF) == 0xA; } 0x2000..0x3000 => self.rom_bank = (self.rom_bank & 0x100) | (data as u16), 0x3000..0x4000 => self.rom_bank = (self.rom_bank & 0xFF) | ((data as u16 & 0b1) << 8), diff --git a/lib/src/processor/memory/rom/mbcs/pocketcamera.rs b/lib/src/processor/memory/rom/mbcs/pocketcamera.rs index 910a48f..a41b386 100644 --- a/lib/src/processor/memory/rom/mbcs/pocketcamera.rs +++ b/lib/src/processor/memory/rom/mbcs/pocketcamera.rs @@ -134,11 +134,7 @@ where self.check_for_new_image(); match address.inner() { 0x0..0x2000 => { - if (data & 0xF) == 0xA { - self.ram_enabled = true - } else { - self.ram_enabled = false - } + self.ram_enabled = (data & 0xF) == 0xA; } 0x2000..0x4000 => { if data < 0x40 {