Skip to content

Commit

Permalink
chore: formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-online committed Nov 4, 2024
1 parent 0656aaf commit 738c409
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/service/targets/emby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use struson::{
use tracing::{debug, error};

#[doc(hidden)]
fn default_true() -> bool {
const fn default_true() -> bool {
true
}

Expand Down
24 changes: 12 additions & 12 deletions src/settings/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn default_hostname() -> String {
}

#[doc(hidden)]
fn default_port() -> u16 {
const fn default_port() -> u16 {
2875
}

Expand Down Expand Up @@ -34,11 +34,11 @@ pub enum LogLevel {
impl std::fmt::Display for LogLevel {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
LogLevel::Trace => write!(f, "trace"),
LogLevel::Debug => write!(f, "debug"),
LogLevel::Info => write!(f, "info"),
LogLevel::Warn => write!(f, "warn"),
LogLevel::Error => write!(f, "error"),
Self::Trace => write!(f, "trace"),
Self::Debug => write!(f, "debug"),
Self::Info => write!(f, "info"),
Self::Warn => write!(f, "warn"),
Self::Error => write!(f, "error"),
}
}
}
Expand All @@ -48,11 +48,11 @@ impl std::str::FromStr for LogLevel {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"trace" => Ok(LogLevel::Trace),
"debug" => Ok(LogLevel::Debug),
"info" => Ok(LogLevel::Info),
"warn" => Ok(LogLevel::Warn),
"error" => Ok(LogLevel::Error),
"trace" => Ok(Self::Trace),
"debug" => Ok(Self::Debug),
"info" => Ok(Self::Info),
"warn" => Ok(Self::Warn),
"error" => Ok(Self::Error),
_ => Err("Invalid log level".to_string()),
}
}
Expand All @@ -76,7 +76,7 @@ pub struct App {

impl Default for App {
fn default() -> Self {
App {
Self {
hostname: default_hostname(),
port: default_port(),
database_url: default_database_url(),
Expand Down
2 changes: 1 addition & 1 deletion src/settings/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Auth {

impl Default for Auth {
fn default() -> Self {
Auth {
Self {
username: default_username(),
password: default_password(),
}
Expand Down
10 changes: 5 additions & 5 deletions src/settings/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ use serde::Deserialize;
use std::path::PathBuf;

#[doc(hidden)]
fn default_check_path() -> bool {
const fn default_check_path() -> bool {
false
}

#[doc(hidden)]
fn default_max_retries() -> i32 {
const fn default_max_retries() -> i32 {
5
}

#[doc(hidden)]
fn default_default_timer_wait() -> u64 {
const fn default_default_timer_wait() -> u64 {
60
}

#[doc(hidden)]
fn default_cleanup_days() -> u64 {
const fn default_cleanup_days() -> u64 {
10
}

Expand Down Expand Up @@ -45,7 +45,7 @@ pub struct Opts {

impl Default for Opts {
fn default() -> Self {
Opts {
Self {
check_path: default_check_path(),
max_retries: default_max_retries(),
default_timer_wait: default_default_timer_wait(),
Expand Down
8 changes: 4 additions & 4 deletions src/tests/utils/check_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod tests {
));
let settings: Settings = serde_json::from_str("{}")?;

assert_eq!(check_auth(&auth, &settings), true);
assert!(check_auth(&auth, &settings));

Ok(())
}
Expand All @@ -21,7 +21,7 @@ mod tests {
let auth = BasicAuth::from(Basic::new("username".to_string(), Some("".to_string())));
let settings: Settings = serde_json::from_str("{}")?;

assert_eq!(check_auth(&auth, &settings), false);
assert!(!check_auth(&auth, &settings));

Ok(())
}
Expand All @@ -34,7 +34,7 @@ mod tests {
));
let settings: Settings = serde_json::from_str("{\"auth\":{\"username\":\"username\"}}")?;

assert_eq!(check_auth(&auth, &settings), true);
assert!(check_auth(&auth, &settings));

Ok(())
}
Expand All @@ -44,7 +44,7 @@ mod tests {
let auth = BasicAuth::from(Basic::new("admin".to_string(), Some("pass".to_string())));
let settings: Settings = serde_json::from_str("{\"auth\":{\"password\":\"pass\"}}")?;

assert_eq!(check_auth(&auth, &settings), true);
assert!(check_auth(&auth, &settings));

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn setup_logs(
let console_layer = fmt::layer()
.with_writer(std::io::stdout)
.with_ansi(true)
.with_timer(timer.clone());
.with_timer(timer);

registry.with(console_layer).init();
}
Expand Down

0 comments on commit 738c409

Please sign in to comment.