From 2617e71348eabe047ff2a05f9997a24ce4d26aa0 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 2 May 2024 09:17:24 -0500 Subject: [PATCH] style: Address warnings --- src/fmt/mod.rs | 2 +- src/fmt/writer/buffer.rs | 8 ++++---- src/fmt/writer/mod.rs | 4 ++-- src/logger.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fmt/mod.rs b/src/fmt/mod.rs index c65f60d..cde7808 100644 --- a/src/fmt/mod.rs +++ b/src/fmt/mod.rs @@ -284,7 +284,7 @@ struct StyledValue { #[cfg(feature = "color")] impl Display for StyledValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let style = self.style; // We need to make sure `f`s settings don't get passed onto the styling but do get passed diff --git a/src/fmt/writer/buffer.rs b/src/fmt/writer/buffer.rs index d4d8bb8..0a8ac36 100644 --- a/src/fmt/writer/buffer.rs +++ b/src/fmt/writer/buffer.rs @@ -58,7 +58,7 @@ impl BufferWriter { let buf = buf.as_bytes(); match &self.target { WritableTarget::WriteStdout => { - let stream = std::io::stdout(); + let stream = io::stdout(); #[cfg(feature = "color")] let stream = anstream::AutoStream::new(stream, self.write_style.into()); let mut stream = stream.lock(); @@ -74,7 +74,7 @@ impl BufferWriter { print!("{}", buf); } WritableTarget::WriteStderr => { - let stream = std::io::stderr(); + let stream = io::stderr(); #[cfg(feature = "color")] let stream = anstream::AutoStream::new(stream, self.write_style.into()); let mut stream = stream.lock(); @@ -105,7 +105,7 @@ impl BufferWriter { } #[cfg(feature = "color")] -fn adapt(buf: &[u8], write_style: WriteStyle) -> std::io::Result> { +fn adapt(buf: &[u8], write_style: WriteStyle) -> io::Result> { use std::io::Write as _; let adapted = Vec::with_capacity(buf.len()); @@ -155,7 +155,7 @@ pub(super) enum WritableTarget { /// Logs will be printed to standard error. PrintStderr, /// Logs will be sent to a custom pipe. - Pipe(Box>), + Pipe(Box>), } impl std::fmt::Debug for WritableTarget { diff --git a/src/fmt/writer/mod.rs b/src/fmt/writer/mod.rs index 2131d74..bb68cb5 100644 --- a/src/fmt/writer/mod.rs +++ b/src/fmt/writer/mod.rs @@ -123,8 +123,8 @@ impl Builder { #[cfg(feature = "auto-color")] let color_choice = if color_choice == WriteStyle::Auto { match &self.target { - Target::Stdout => anstream::AutoStream::choice(&std::io::stdout()).into(), - Target::Stderr => anstream::AutoStream::choice(&std::io::stderr()).into(), + Target::Stdout => anstream::AutoStream::choice(&io::stdout()).into(), + Target::Stderr => anstream::AutoStream::choice(&io::stderr()).into(), Target::Pipe(_) => color_choice, } } else { diff --git a/src/logger.rs b/src/logger.rs index 1639c07..b32310d 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -240,9 +240,9 @@ impl Builder { /// [`Formatter`]: fmt/struct.Formatter.html /// [`String`]: https://doc.rust-lang.org/stable/std/string/struct.String.html /// [`std::fmt`]: https://doc.rust-lang.org/std/fmt/index.html - pub fn format(&mut self, format: F) -> &mut Self + pub fn format(&mut self, format: F) -> &mut Self where - F: Fn(&mut Formatter, &Record<'_>) -> io::Result<()> + Sync + Send, + F: Fn(&mut Formatter, &Record<'_>) -> io::Result<()> + Sync + Send + 'static, { self.format.custom_format = Some(Box::new(format)); self