diff --git a/src/devices/printer.rs b/src/devices/printer.rs index c52d2c0a2f93b379e60c983925fd32e32e9b42b4..e5e81931070be60f85884dd780b9c9333627b8c7 100644 --- a/src/devices/printer.rs +++ b/src/devices/printer.rs @@ -1,7 +1,6 @@ use crate::serial::SerialDevice; -pub struct PrinterDevice { -} +pub struct PrinterDevice {} impl PrinterDevice { pub fn new() -> Self { diff --git a/src/devices/stdout.rs b/src/devices/stdout.rs index 27067a802811db0482137a9ab163d1631907fb68..efdd32cf27ed4e155fd81c393c0354d8f8081d53 100644 --- a/src/devices/stdout.rs +++ b/src/devices/stdout.rs @@ -3,14 +3,12 @@ use std::io::{stdout, Write}; use crate::serial::SerialDevice; pub struct StdoutDevice { - flush: bool + flush: bool, } impl StdoutDevice { pub fn new(flush: bool) -> Self { - Self { - flush - } + Self { flush } } } diff --git a/src/gb.rs b/src/gb.rs index d7b433b2675a5bd4984c686fa7f6b68c2d9c6736..e107c389a5820a06f68ced464798a07410728a7e 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -2,6 +2,7 @@ use crate::{ apu::Apu, cpu::Cpu, data::{BootRom, CGB_BOOT, DMG_BOOT, DMG_BOOTIX, MGB_BOOTIX, SGB_BOOT}, + devices::{printer::PrinterDevice, stdout::StdoutDevice}, gen::{COMPILATION_DATE, COMPILATION_TIME, COMPILER, COMPILER_VERSION}, mmu::Mmu, pad::{Pad, PadKey}, @@ -9,7 +10,7 @@ use crate::{ rom::Cartridge, serial::Serial, timer::Timer, - util::read_file, devices::{stdout::StdoutDevice, printer::PrinterDevice}, + util::read_file, }; use std::collections::VecDeque; diff --git a/src/lib.rs b/src/lib.rs index 65f078b6c41d8ffc046f827b7143210e5266d1d3..80f4f5b8e995c1081e8319a0c9b396a73503375a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,8 +2,8 @@ pub mod apu; pub mod cpu; -pub mod devices; pub mod data; +pub mod devices; pub mod gb; pub mod gen; pub mod inst; diff --git a/src/serial.rs b/src/serial.rs index ac97c6f576d425b6509c3fab32abaccc5d1c0344..d528bac8c6aeb81e73ba88b584c6be60913f1211 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -159,7 +159,7 @@ impl Serial { if self.bit_count == 8 { self.transferring = false; self.length = 0; - self.bit_count = 0; + self.bit_count = 0; // signals the interrupt for the serial // transfer completion, indicating that @@ -175,8 +175,7 @@ impl Default for Serial { } } -pub struct NullDevice { -} +pub struct NullDevice {} impl NullDevice { pub fn new() -> Self { @@ -195,6 +194,5 @@ impl SerialDevice for NullDevice { 0xff } - fn receive(&mut self, _: u8) { - } + fn receive(&mut self, _: u8) {} }