diff options
author | Efertone <efertone@pm.me> | 2023-03-05 13:36:21 +0100 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2023-03-06 21:43:15 +0000 |
commit | e17a1af47621cf898bbea6991834ccafc08daf3c (patch) | |
tree | 80f9d5a35a855a392d0e89c7628093f78982b9c0 | |
parent | 2f7c197cd703e199978bcb085adba6bc01bddc25 (diff) |
remove depth from config.toml and fix style issues
Signed-off-by: Efertone <efertone@pm.me>
-rw-r--r-- | config/config.toml | 3 | ||||
-rw-r--r-- | 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::<usize>() { - 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() }; |