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

Slightly improve serde documentation #1519

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Conversation

pitdicker
Copy link
Collaborator

Fixes #1484.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

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

Project coverage is 91.81%. Comparing base (236b7ad) to head (2d2062f).
Report is 1 commits behind head on main.

Files Patch % Lines
src/datetime/serde.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1519   +/-   ##
=======================================
  Coverage   91.81%   91.81%           
=======================================
  Files          40       40           
  Lines       18351    18355    +4     
=======================================
+ Hits        16849    16853    +4     
  Misses       1502     1502           

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

@pitdicker
Copy link
Collaborator Author

No clue yet why a warning shows up for the naive::time module on this PR but not on main:

error: redundant explicit link target
   --> src/naive/time/mod.rs:193:18
    |
193 | /// [`DateTime`](crate::DateTime) with fractional minutes as offset, or using
    |      ----------  ^^^^^^^^^^^^^^^ explicit target is redundant
    |      |
    |      because label contains path that resolves to same destination
    |
    = note: when a link's destination is not specified,
            the label is used to resolve intra-doc links
    = note: `-D rustdoc::redundant-explicit-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::redundant_explicit_links)]`
help: remove explicit link target
    |
193 | /// [`DateTime`] with fractional minutes as offset, or using
    |     ~~~~~~~~~~~~

@pitdicker
Copy link
Collaborator Author

No clue yet why a warning shows up for the naive::time module on this PR but not on main:

Seems to be a bug in the error reporting of rustdoc. The redundant target was in libs.rs but for a similar DateTime link.

@@ -23,10 +23,9 @@ pub struct MicroSecondsTimestampVisitor;
#[derive(Debug)]
pub struct MilliSecondsTimestampVisitor;

/// Serialize into an ISO 8601 formatted string.
/// Serialize into an ISO 8601 formatted string, with a format similar to RFC 3339.
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems weirdly imprecise, and its precision doesn't match the string used for expecting().

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is the RFC 3339 format with the addition that it can (de)serialize datetimes outside the 0..=9999 years range using the ISO 8601 syntax. I'll try to word it better.

@@ -65,13 +64,9 @@ impl<'de> de::Visitor<'de> for DateTimeVisitor {
}
}

/// Deserialize a value that optionally includes a timezone offset in its
/// string representation
/// Deserialize an RFC 3339 formatted string into a `DateTime<FixedOffset>`.
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, it's somewhat on purpose that the first line of docstrings doesn't have a .. These are sentence fragments, not full sentences.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Really? Okay.

@pitdicker pitdicker merged commit 04eb6d3 into chronotope:main Mar 18, 2024
34 of 35 checks passed
@pitdicker pitdicker deleted the serde_doc branch March 18, 2024 14:39
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.

Deserializing DateTime from unix timestamp is not implemented, despite description
2 participants