Skip to content

Commit c337aba

Browse files
authored
Merge pull request #116 from jfinkels/remove-add-zero-months
Remove more useless calls to add zero months to date
2 parents 63cfc01 + 65cd15d commit c337aba

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/parse_relative_time.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,7 @@ mod tests {
297297
parse_relative_time_at_date(now, "1 year").unwrap(),
298298
now.checked_add_months(Months::new(12)).unwrap()
299299
);
300-
assert_eq!(
301-
parse_relative_time_at_date(now, "this year").unwrap(),
302-
now.checked_add_months(Months::new(0)).unwrap()
303-
);
300+
assert_eq!(parse_relative_time_at_date(now, "this year").unwrap(), now);
304301
assert_eq!(
305302
parse_relative_time_at_date(now, "-2 years").unwrap(),
306303
now.checked_sub_months(Months::new(24)).unwrap()
@@ -338,10 +335,7 @@ mod tests {
338335
parse_relative_time_at_date(now, "1 month").unwrap(),
339336
add_months(now, 1, false).unwrap(),
340337
);
341-
assert_eq!(
342-
parse_relative_time_at_date(now, "this month").unwrap(),
343-
now.checked_add_months(Months::new(0)).unwrap()
344-
);
338+
assert_eq!(parse_relative_time_at_date(now, "this month").unwrap(), now);
345339
assert_eq!(
346340
parse_relative_time_at_date(now, "1 month and 2 weeks").unwrap(),
347341
add_months(now, 1, false)

0 commit comments

Comments
 (0)