From 6241069e68e096f0cc59f20b4ff10fceca0b9cfb Mon Sep 17 00:00:00 2001 From: ByteOtter Date: Wed, 14 Aug 2024 13:58:12 +0200 Subject: [PATCH] Apply proper formatting --- isotoenv/src/lib.rs | 6 +++--- isotoenv/src/logging.rs | 30 +++++++++++++++--------------- isotomachine/src/lib.rs | 6 +++--- isotomachine/src/logging.rs | 30 +++++++++++++++--------------- isototest/src/lib.rs | 4 ++-- isototest/src/logging.rs | 30 +++++++++++++++--------------- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/isotoenv/src/lib.rs b/isotoenv/src/lib.rs index 517cddc..d2f399f 100644 --- a/isotoenv/src/lib.rs +++ b/isotoenv/src/lib.rs @@ -7,14 +7,14 @@ //! * `default-logging` - Provides you with a sensible logger configuration using the `env_logger` crate. // Organize library structure -pub mod logging; pub mod errors; +pub mod logging; // Provide code on the root level of the library #[cfg(feature = "default-logging")] -use crate::logging::init_default_logging; -#[cfg(feature = "default-logging")] use crate::errors::util_errors::LoggingError; +#[cfg(feature = "default-logging")] +use crate::logging::init_default_logging; #[cfg(feature = "default-logging")] pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> { diff --git a/isotoenv/src/logging.rs b/isotoenv/src/logging.rs index 814f5ed..3cf5304 100644 --- a/isotoenv/src/logging.rs +++ b/isotoenv/src/logging.rs @@ -1,11 +1,11 @@ //! This module provides a sensible default configuration of a logging system. +#[cfg(feature = "default-logging")] +use crate::errors::util_errors::LoggingError; #[cfg(feature = "default-logging")] use env_logger::Builder; #[cfg(feature = "default-logging")] use std::io::Write; -#[cfg(feature = "default-logging")] -use crate::errors::util_errors::LoggingError; pub const LOG_TARGET: &str = "[isototest]"; @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr Some("info") | None => { log_builder(log::LevelFilter::Info); Ok(()) - }, + } Some("debug") => { log_builder(log::LevelFilter::Debug); Ok(()) - }, + } Some("trace") => { log_builder(log::LevelFilter::Trace); Ok(()) - }, - Some(invalid) => { - Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid))) } + Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!( + "Invalid log level '{}'!", + invalid + ))), } } @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) { .filter_level(level) .format(|buf, record| { writeln!( - buf, - "{} [{}] {}: {}", - buf.timestamp(), - record.level(), - record.target(), - record.args() - ) + buf, + "{} [{}] {}: {}", + buf.timestamp(), + record.level(), + record.target(), + record.args() + ) }) .init(); } - diff --git a/isotomachine/src/lib.rs b/isotomachine/src/lib.rs index f4b3491..b7b7175 100644 --- a/isotomachine/src/lib.rs +++ b/isotomachine/src/lib.rs @@ -7,14 +7,14 @@ //! * `default-logging` - Provides you with a sensible logger configuration using the `env_logger` crate. // Organize library structure -pub mod logging; pub mod errors; +pub mod logging; // Provide code on the root level of the library #[cfg(feature = "default-logging")] -use crate::logging::init_default_logging; -#[cfg(feature = "default-logging")] use crate::errors::util_errors::LoggingError; +#[cfg(feature = "default-logging")] +use crate::logging::init_default_logging; #[cfg(feature = "default-logging")] pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> { diff --git a/isotomachine/src/logging.rs b/isotomachine/src/logging.rs index 814f5ed..3cf5304 100644 --- a/isotomachine/src/logging.rs +++ b/isotomachine/src/logging.rs @@ -1,11 +1,11 @@ //! This module provides a sensible default configuration of a logging system. +#[cfg(feature = "default-logging")] +use crate::errors::util_errors::LoggingError; #[cfg(feature = "default-logging")] use env_logger::Builder; #[cfg(feature = "default-logging")] use std::io::Write; -#[cfg(feature = "default-logging")] -use crate::errors::util_errors::LoggingError; pub const LOG_TARGET: &str = "[isototest]"; @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr Some("info") | None => { log_builder(log::LevelFilter::Info); Ok(()) - }, + } Some("debug") => { log_builder(log::LevelFilter::Debug); Ok(()) - }, + } Some("trace") => { log_builder(log::LevelFilter::Trace); Ok(()) - }, - Some(invalid) => { - Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid))) } + Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!( + "Invalid log level '{}'!", + invalid + ))), } } @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) { .filter_level(level) .format(|buf, record| { writeln!( - buf, - "{} [{}] {}: {}", - buf.timestamp(), - record.level(), - record.target(), - record.args() - ) + buf, + "{} [{}] {}: {}", + buf.timestamp(), + record.level(), + record.target(), + record.args() + ) }) .init(); } - diff --git a/isototest/src/lib.rs b/isototest/src/lib.rs index 5460173..c3ed3c0 100644 --- a/isototest/src/lib.rs +++ b/isototest/src/lib.rs @@ -65,9 +65,9 @@ pub(crate) mod types; // Provide code on the root level of the library #[cfg(feature = "default-logging")] -use crate::logging::init_default_logging; -#[cfg(feature = "default-logging")] use crate::errors::util_errors::LoggingError; +#[cfg(feature = "default-logging")] +use crate::logging::init_default_logging; #[cfg(feature = "default-logging")] pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> { diff --git a/isototest/src/logging.rs b/isototest/src/logging.rs index 814f5ed..3cf5304 100644 --- a/isototest/src/logging.rs +++ b/isototest/src/logging.rs @@ -1,11 +1,11 @@ //! This module provides a sensible default configuration of a logging system. +#[cfg(feature = "default-logging")] +use crate::errors::util_errors::LoggingError; #[cfg(feature = "default-logging")] use env_logger::Builder; #[cfg(feature = "default-logging")] use std::io::Write; -#[cfg(feature = "default-logging")] -use crate::errors::util_errors::LoggingError; pub const LOG_TARGET: &str = "[isototest]"; @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr Some("info") | None => { log_builder(log::LevelFilter::Info); Ok(()) - }, + } Some("debug") => { log_builder(log::LevelFilter::Debug); Ok(()) - }, + } Some("trace") => { log_builder(log::LevelFilter::Trace); Ok(()) - }, - Some(invalid) => { - Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid))) } + Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!( + "Invalid log level '{}'!", + invalid + ))), } } @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) { .filter_level(level) .format(|buf, record| { writeln!( - buf, - "{} [{}] {}: {}", - buf.timestamp(), - record.level(), - record.target(), - record.args() - ) + buf, + "{} [{}] {}: {}", + buf.timestamp(), + record.level(), + record.target(), + record.args() + ) }) .init(); } -