squeeze if-branches in date validation method

This commit is contained in:
dvvvvvv 2019-11-10 17:36:50 +09:00 committed by Abin Simon
parent 58d44a6450
commit f1fed05413

View file

@ -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())
}
}