From 7ab0a596c9eac3fc59941d5dc96c32bb6771f231 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Thu, 31 Aug 2023 22:40:30 -0500 Subject: [PATCH] cpu.rs, tests.rs: fix clippy lints (thanks clippy) --- src/cpu.rs | 16 +++++++++------- src/cpu/tests.rs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cpu.rs b/src/cpu.rs index 631e0f9..508187a 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -539,6 +539,7 @@ impl CPU { /// ``` pub fn dump(&self) { //let dumpstyle = owo_colors::Style::new().bright_black(); + use std::fmt::Write; std::println!( "PC: {:04x}, SP: {:04x}, I: {:04x}\n{}DLY: {}, SND: {}, CYC: {:6}", self.pc, @@ -547,16 +548,17 @@ impl CPU { self.v .into_iter() .enumerate() - .map(|(i, gpr)| { - format!( - "v{i:X}: {gpr:02x} {}", + .fold(String::new(), |mut s, (i, gpr)| { + let _ = write!( + s, + "{}v{i:X}: {gpr:02x}", match i % 4 { - 3 => "\n", + 0 => "\n", _ => "", } - ) - }) - .collect::(), + ); + s + }), self.delay, self.sound, self.cycle, diff --git a/src/cpu/tests.rs b/src/cpu/tests.rs index 7e262f2..345e5a8 100644 --- a/src/cpu/tests.rs +++ b/src/cpu/tests.rs @@ -956,7 +956,7 @@ mod io { } mod bcdtest { - pub(self) use super::*; + use super::*; struct BCDTest { // value to test