Skip to content

Commit

Permalink
Merge pull request #319 from epage/style
Browse files Browse the repository at this point in the history
style: Address warnings
  • Loading branch information
epage committed May 2, 2024
2 parents cb1824b + 2617e71 commit 664c2fa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ struct StyledValue<T> {

#[cfg(feature = "color")]
impl<T: Display> Display for StyledValue<T> {
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
Expand Down
8 changes: 4 additions & 4 deletions src/fmt/writer/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -105,7 +105,7 @@ impl BufferWriter {
}

#[cfg(feature = "color")]
fn adapt(buf: &[u8], write_style: WriteStyle) -> std::io::Result<Vec<u8>> {
fn adapt(buf: &[u8], write_style: WriteStyle) -> io::Result<Vec<u8>> {
use std::io::Write as _;

let adapted = Vec::with_capacity(buf.len());
Expand Down Expand Up @@ -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<Mutex<dyn std::io::Write + Send + 'static>>),
Pipe(Box<Mutex<dyn io::Write + Send + 'static>>),
}

impl std::fmt::Debug for WritableTarget {
Expand Down
4 changes: 2 additions & 2 deletions src/fmt/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F: 'static>(&mut self, format: F) -> &mut Self
pub fn format<F>(&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
Expand Down

0 comments on commit 664c2fa

Please sign in to comment.