diff options
author | dvvvvvv <dvvvvvv@dvvvvvv.com> | 2019-11-10 17:36:50 +0900 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2019-12-16 16:41:50 +0530 |
commit | f1fed05413f1756ff784363f6c4476d922378e69 (patch) | |
tree | b1bc974e652637ae7f6d51a70621f80e80d007a0 | |
parent | 58d44a6450951eeff7f3828f216957042aa9193b (diff) |
squeeze if-branches in date validation method
-rw-r--r-- | src/app.rs | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -208,15 +208,10 @@ fn validate_date_argument(arg: String) -> Result<(), String> { use std::error::Error; if arg.starts_with('+') { validate_time_format(&arg).map_err(|err| err.description().to_string()) - } else if &arg == "date" { - Result::Ok(()) - } else if &arg == "relative" { + } else if &arg == "date" || &arg == "relative" { Result::Ok(()) } else { - Result::Err( - "possible values: date, relative, +date-time-format" - .to_owned() - ) + Result::Err("possible values: date, relative, +date-time-format".to_owned()) } } |