chronotope / chrono

Date and time library for Rust
Other
3.3k stars 523 forks source link

Convert methods on `TimeDelta` to return `Result` #1538

Closed pitdicker closed 6 months ago

pitdicker commented 6 months ago

I kept TimeDelta::{checked_add, checked_sub} like they are, returning an Option. That seems in line with checked_add on integers.

We are now at a point where clean-ups are possible. The last commit gets rid of the expect(ok!(/* ... */)) that developed while parts of the API returned Result and parts returned Option.

Once this PR and #1537 land we can get rid of the ok! and try_opt! macros.

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 94.36620% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 93.98%. Comparing base (21ee9b7) to head (bb85a51).

Files Patch % Lines
src/time_delta.rs 96.55% 2 Missing :warning:
src/lib.rs 66.66% 1 Missing :warning:
src/naive/datetime/mod.rs 83.33% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## 0.5.x #1538 +/- ## ========================================== + Coverage 93.96% 93.98% +0.02% ========================================== Files 37 37 Lines 16662 16656 -6 ========================================== - Hits 15656 15654 -2 + Misses 1006 1002 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.