From a915a2977f20b45de0a115e399113206a258f919 Mon Sep 17 00:00:00 2001 From: Kit Rhett Aultman Date: Mon, 2 Sep 2024 19:45:48 -0400 Subject: [PATCH] console.rs: write entire strings without a loop The MmioSerialPort already has a write_str() function, so there's no need to loop the bytes. Actually, given that MmioSerialPort also has a fmt::Write trait, it's possible that we don't actually need to implement it for Console at all. --- src/console.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/console.rs b/src/console.rs index 3644555..511e1a5 100644 --- a/src/console.rs +++ b/src/console.rs @@ -35,10 +35,7 @@ impl Console { impl core::fmt::Write for Console { fn write_str(&mut self, s: &str) -> core::fmt::Result { - for byte in s.bytes() { - self.serial_port.send(byte); - } - Ok(()) + return self.serial_port.write_str(s); } } -- 2.34.1