summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvvvvvv <dvvvvvv@dvvvvvv.com>2019-11-10 17:36:50 +0900
committerAbin Simon <abinsimon10@gmail.com>2019-12-16 16:41:50 +0530
commitf1fed05413f1756ff784363f6c4476d922378e69 (patch)
treeb1bc974e652637ae7f6d51a70621f80e80d007a0
parent58d44a6450951eeff7f3828f216957042aa9193b (diff)
squeeze if-branches in date validation method
-rw-r--r--src/app.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/app.rs b/src/app.rs
index 291bebe..3078aae 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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())
}
}