From 939687dd75b606186989aa72fe43e716eaca5659 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 17 Jan 2024 19:37:48 -0600 Subject: [PATCH] style: Make clippy happy --- src/fmt/writer/buffer/mod.rs | 2 +- src/fmt/writer/mod.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fmt/writer/buffer/mod.rs b/src/fmt/writer/buffer/mod.rs index d3b44de..4e678b2 100644 --- a/src/fmt/writer/buffer/mod.rs +++ b/src/fmt/writer/buffer/mod.rs @@ -8,7 +8,7 @@ The terminal printing is shimmed when the `termcolor` crate is not available. #[cfg(feature = "color")] mod termcolor; #[cfg(feature = "color")] -pub(in crate::fmt) use termcolor::*; +pub(in crate::fmt) use self::termcolor::*; #[cfg(not(feature = "color"))] mod plain; #[cfg(not(feature = "color"))] diff --git a/src/fmt/writer/mod.rs b/src/fmt/writer/mod.rs index ba0ec7e..41466b9 100644 --- a/src/fmt/writer/mod.rs +++ b/src/fmt/writer/mod.rs @@ -67,13 +67,15 @@ impl WritableTarget { let buf = buf.as_bytes(); match self { WritableTarget::WriteStdout => { - let mut stream = std::io::stdout().lock(); + let stream = std::io::stdout(); + let mut stream = stream.lock(); stream.write_all(buf)?; stream.flush()?; } WritableTarget::PrintStdout => print!("{}", String::from_utf8_lossy(buf)), WritableTarget::WriteStderr => { - let mut stream = std::io::stderr().lock(); + let stream = std::io::stderr(); + let mut stream = stream.lock(); stream.write_all(buf)?; stream.flush()?; }