From c5ef259a979df1c082f1b92ea4a931a9992a5bb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sat, 15 Apr 2023 23:03:31 +0100
Subject: [PATCH] fix: better code format

---
 src/devices/printer.rs | 3 +--
 src/devices/stdout.rs  | 6 ++----
 src/gb.rs              | 3 ++-
 src/lib.rs             | 2 +-
 src/serial.rs          | 8 +++-----
 5 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/devices/printer.rs b/src/devices/printer.rs
index c52d2c0a..e5e81931 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 27067a80..efdd32cf 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 d7b433b2..e107c389 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 65f078b6..80f4f5b8 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 ac97c6f5..d528bac8 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) {}
 }
-- 
GitLab