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

Document panics in Add/Sub impls and use expect #1316

Merged
merged 7 commits into from
Sep 26, 2023

Conversation

pitdicker
Copy link
Collaborator

A large but simple PR.

I made sure all Add/Sub documentation on NaiveDate, NaiveTime, NaiveDateTime and DateTime follows the same format and mentions panics.

The implementations now use expect instead of unwrap.
And I changed impl Add<std::time::Duration> for NaiveTime and Sub to take a modulus of the duration before converting to remove a panic case.

Fixes #1302, #1314.

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #1316 (cdecf2a) into 0.4.x (d450b68) will increase coverage by 0.02%.
The diff coverage is 92.10%.

@@            Coverage Diff             @@
##            0.4.x    #1316      +/-   ##
==========================================
+ Coverage   91.25%   91.27%   +0.02%     
==========================================
  Files          38       38              
  Lines       17114    17121       +7     
==========================================
+ Hits        15617    15627      +10     
+ Misses       1497     1494       -3     
Files Changed Coverage Δ
src/datetime/mod.rs 84.97% <50.00%> (-0.26%) ⬇️
src/naive/datetime/mod.rs 97.35% <93.93%> (+<0.01%) ⬆️
src/naive/date.rs 96.20% <100.00%> (+<0.01%) ⬆️
src/naive/time/mod.rs 96.53% <100.00%> (+0.60%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

FWIW all these impl docs are nice to have, I guess, but I would consider them very low priority.

@pitdicker
Copy link
Collaborator Author

I would consider them very low priority.

Agreed 😄

@pitdicker pitdicker merged commit 652bd78 into chronotope:0.4.x Sep 26, 2023
37 checks passed
@pitdicker pitdicker deleted the add_sub_panic_docs branch September 26, 2023 14:46
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