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()?; }