serial_buffer: trim qualified paths

Import std::io instead of spelling the full paths at every use site.

Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com>
Assisted-by: Claude:Opus-4.8
This commit is contained in:
Henry Hrvoje Tonkovac
2026-06-06 20:16:37 +02:00
committed by Rob Bradford
parent 0b3af8aed2
commit 89afb088ec
+4 -4
View File
@@ -4,7 +4,7 @@
// //
use std::collections::VecDeque; use std::collections::VecDeque;
use std::io::Write; use std::io::{self, Write};
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
@@ -45,7 +45,7 @@ impl SerialBuffer {
} }
impl Write for SerialBuffer { impl Write for SerialBuffer {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
// Simply fill the buffer if we're not allowed to write to the out // Simply fill the buffer if we're not allowed to write to the out
// device. // device.
if !self.write_out.load(Ordering::Acquire) { if !self.write_out.load(Ordering::Acquire) {
@@ -77,7 +77,7 @@ impl Write for SerialBuffer {
} }
} }
Err(e) => { Err(e) => {
if !matches!(e.kind(), std::io::ErrorKind::WouldBlock) { if !matches!(e.kind(), io::ErrorKind::WouldBlock) {
return Err(e); return Err(e);
} }
self.fill_buffer(&buf[offset..]); self.fill_buffer(&buf[offset..]);
@@ -95,7 +95,7 @@ impl Write for SerialBuffer {
// This function flushes the content of the buffer to the out device if // This function flushes the content of the buffer to the out device if
// it is allowed to, otherwise this is a no-op. // it is allowed to, otherwise this is a no-op.
fn flush(&mut self) -> Result<(), std::io::Error> { fn flush(&mut self) -> io::Result<()> {
if !self.write_out.load(Ordering::Acquire) { if !self.write_out.load(Ordering::Acquire) {
return Ok(()); return Ok(());
} }