Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checked NaiveWeek methods #1600

Merged
merged 4 commits into from
Aug 19, 2024
Merged

Checked NaiveWeek methods #1600

merged 4 commits into from
Aug 19, 2024

Conversation

bragov4ik
Copy link
Contributor

@bragov4ik bragov4ik commented Jul 18, 2024

Currently, all NaiveWeek's public methods panic on overflow. This PR allows to handle such scenarios.

Seems to solve #1469 (NaiveWeek part).

  • I'm not sure that Result makes sense here, since only overflow results in None. Thus Option.
  • Adding checked_* methods in order to not break API

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 91.11%. Comparing base (1eb3174) to head (473f7c2).
Report is 8 commits behind head on main.

Files Patch % Lines
src/naive/mod.rs 88.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1600      +/-   ##
==========================================
- Coverage   91.12%   91.11%   -0.02%     
==========================================
  Files          37       37              
  Lines       17057    17104      +47     
==========================================
+ Hits        15543    15584      +41     
- Misses       1514     1520       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@djc
Copy link
Member

djc commented Jul 19, 2024

This makes sense to me, thanks. In its current form the diffs get a little ugly, would you mind doing this with one commit per method and putting the panicking method above the checked method? Also probably prefer not to use the "recoverable"/"recover" wording which IMO is not used very often.

@bragov4ik bragov4ik changed the title Recoverable NaiveWeek methods Checked NaiveWeek methods Jul 22, 2024
src/naive/mod.rs Outdated Show resolved Hide resolved
src/naive/mod.rs Show resolved Hide resolved
src/naive/mod.rs Show resolved Hide resolved
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo one nit, thanks! (Please fix it in the originating commit.)

src/naive/mod.rs Outdated Show resolved Hide resolved
@djc djc merged commit 081c648 into chronotope:main Aug 19, 2024
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants