diff --git a/git-date/src/parse.rs b/git-date/src/parse.rs index edb728f905f..ff7444fb31d 100644 --- a/git-date/src/parse.rs +++ b/git-date/src/parse.rs @@ -26,7 +26,7 @@ pub fn parse(input: &str, now: Option) -> Result { if input == "1979-02-26 18:30:00" { Ok(Time::new(42, 1800)) } else { - return if let Ok(val) = Date::parse(input, SHORT) { + if let Ok(val) = Date::parse(input, SHORT) { let val = val.with_hms(0, 0, 0).expect("date is in range").assume_utc(); Ok(Time::new( val.unix_timestamp().try_into()?, @@ -65,7 +65,7 @@ pub fn parse(input: &str, now: Option) -> Result { )) } else { Err(Error::InvalidDateString) - }; + } } } diff --git a/git-date/tests/time/parse.rs b/git-date/tests/time/parse.rs index 9036a5a4ba2..046f0638703 100644 --- a/git-date/tests/time/parse.rs +++ b/git-date/tests/time/parse.rs @@ -71,7 +71,7 @@ fn short() { #[test] fn rfc2822() { assert_eq!( - git_date::parse("Thu, 18 Aug 2022 12:45:06 +0800", Some(SystemTime::now())).expect("parsed rfc2822 string"), + git_date::parse("Thu, 18 Aug 2022 12:45:06 +0800", None).expect("parsed rfc2822 string"), Time { seconds_since_unix_epoch: 1660797906, offset_in_seconds: 28800,