From a8e5d09ff0fa5a5b382b6d6b988318bf8968c460 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Fri, 9 Jul 2021 17:20:15 -0400 Subject: [PATCH] clippy lints --- src/config.rs | 7 +++---- src/units.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index e4fedc2..50c8964 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,9 +27,8 @@ pub fn load_config() -> Result { let config_file: Result = { let config_path = cli_args .config_path - .as_ref() - .map(PathBuf::as_path) - .unwrap_or(Path::new("./settings.yaml")); + .as_deref() + .unwrap_or_else(|| Path::new("./settings.yaml")); match File::open(config_path) { Ok(file) => serde_yaml::from_reader(file), Err(e) if e.kind() == ErrorKind::NotFound => { @@ -138,7 +137,7 @@ struct YamlExtendedOptions { logging_level: LevelFilter, } -fn default_logging_level() -> LevelFilter { +const fn default_logging_level() -> LevelFilter { LevelFilter::Info } diff --git a/src/units.rs b/src/units.rs index 1b3c83c..0ea9df1 100644 --- a/src/units.rs +++ b/src/units.rs @@ -26,7 +26,7 @@ impl Display for Port { pub struct Mebibytes(usize); impl Mebibytes { - pub const fn get(&self) -> usize { + pub const fn get(self) -> usize { self.0 } }