diff options
author | Ben S <ogham@bsago.me> | 2015-11-19 12:19:04 +0000 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-11-19 12:19:04 +0000 |
commit | c543e61cedde1879650dcf59457f109f9636068f (patch) | |
tree | f7ac4858c381216ef0fca0a2544a625a48890e00 /src | |
parent | 9218799e6efb4b6bf74d771b6c1767c3672e140f (diff) |
Improve code in two insignificant little places
Diffstat (limited to 'src')
-rw-r--r-- | src/options.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/options.rs b/src/options.rs index 27b1af7..50d559d 100644 --- a/src/options.rs +++ b/src/options.rs @@ -425,7 +425,7 @@ impl Default for SortField { impl OptionSet for SortField { fn deduce(matches: &getopts::Matches) -> Result<SortField, Misfire> { if let Some(word) = matches.opt_str("sort") { - match &word[..] { + match &*word { "name" | "filename" => Ok(SortField::Name), "size" | "filesize" => Ok(SortField::Size), "ext" | "extension" => Ok(SortField::Extension), @@ -519,13 +519,11 @@ impl OptionSet for TimeTypes { otherwise => Err(Misfire::bad_argument("time", otherwise)), } } + else if modified || created || accessed { + Ok(TimeTypes { accessed: accessed, modified: modified, created: created }) + } else { - if modified || created || accessed { - Ok(TimeTypes { accessed: accessed, modified: modified, created: created }) - } - else { - Ok(TimeTypes::default()) - } + Ok(TimeTypes::default()) } } } |