From e17a1af47621cf898bbea6991834ccafc08daf3c Mon Sep 17 00:00:00 2001 From: Efertone Date: Sun, 5 Mar 2023 13:36:21 +0100 Subject: [PATCH] remove depth from config.toml and fix style issues Signed-off-by: Efertone --- config/config.toml | 3 --- src/config.rs | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/config/config.toml b/config/config.toml index 6d10c1a..314cd2a 100644 --- a/config/config.toml +++ b/config/config.toml @@ -26,6 +26,3 @@ ignore-hidden=true # print sizes in powers of 1000 (e.g., 1.1G) iso=true - -# Depth to show -depth=1 diff --git a/src/config.rs b/src/config.rs index 96d1aa5..9a77f52 100644 --- a/src/config.rs +++ b/src/config.rs @@ -63,7 +63,7 @@ impl Config { pub fn get_depth(&self, options: &ArgMatches) -> usize { if let Some(v) = options.value_of("depth") { if let Ok(v) = v.parse::() { - return v + return v; } } @@ -151,7 +151,7 @@ pub fn get_config() -> Config { mod tests { #[allow(unused_imports)] use super::*; - use clap::{Command, Arg, ArgMatches}; + use clap::{Arg, ArgMatches, Command}; #[test] fn test_conversion() { @@ -190,7 +190,7 @@ mod tests { assert_eq!(c.get_depth(&args), 5); // Config is defined and flag is not defined. - let c = Config{ + let c = Config { depth: Some(3), ..Default::default() }; @@ -198,7 +198,7 @@ mod tests { assert_eq!(c.get_depth(&args), 3); // Both config and flag are defined. - let c = Config{ + let c = Config { depth: Some(3), ..Default::default() };