Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run rust fmt #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ extern crate log;
use std::fmt;
use std::sync::atomic::{AtomicUsize, Ordering};

use env_logger::{fmt::{Color, Style, StyledValue}, Builder};
use env_logger::{
fmt::{Color, Style, StyledValue},
Builder,
};
use log::Level;


/// Initializes the global logger with a pretty env logger.
///
/// This should be called early in the execution of a Rust program, and the
Expand Down Expand Up @@ -141,7 +143,9 @@ pub fn try_init_custom_env(environment_variable_name: &str) -> Result<(), log::S
/// # Errors
///
/// This function fails to set the global logger if one has already been set.
pub fn try_init_timed_custom_env(environment_variable_name: &str) -> Result<(), log::SetLoggerError> {
pub fn try_init_timed_custom_env(
environment_variable_name: &str,
) -> Result<(), log::SetLoggerError> {
let mut builder = formatted_timed_builder();

if let Ok(s) = ::std::env::var(environment_variable_name) {
Expand Down Expand Up @@ -174,13 +178,7 @@ pub fn formatted_builder() -> Builder {
width: max_width,
});

writeln!(
f,
" {} {} > {}",
level,
target,
record.args(),
)
writeln!(f, " {} {} > {}", level, target, record.args(),)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can drop the trailing comma? (Same on line 211)

});

builder
Expand Down Expand Up @@ -210,14 +208,7 @@ pub fn formatted_timed_builder() -> Builder {

let time = f.timestamp_millis();

writeln!(
f,
" {} {} {} > {}",
time,
level,
target,
record.args(),
)
writeln!(f, " {} {} {} > {}", time, level, target, record.args(),)
});

builder
Expand All @@ -230,7 +221,7 @@ struct Padded<T> {

impl<T: fmt::Display> fmt::Display for Padded<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{: <width$}", self.value, width=self.width)
write!(f, "{: <width$}", self.value, width = self.width)
}
}

Expand Down