Skip to content

Commit

Permalink
chore: comment epoch literals w/ RFC 3339 vals.
Browse files Browse the repository at this point in the history
This commit removes some TODOs on `clippy::unreadable_literal` allows in
the integration tests by adding RFC 3339 values in comments for each of
the UNIX epoch literals.

In an ideal world we'd specify the dates _as_ RFC 3339 date strings and
parse them to a UNIX epoch, but doing so would require a new crate
dependency. This approach makes the literals more readable and requires
no new deps.
  • Loading branch information
cpu committed Mar 13, 2023
1 parent c675914 commit d986ba0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub fn netflix() {
let anchors = vec![webpki::TrustAnchor::try_from_cert_der(ca).unwrap()];
let anchors = webpki::TlsServerTrustAnchors(&anchors);

#[allow(clippy::unreadable_literal)] // TODO: Make this clear.
let time = webpki::Time::from_seconds_since_unix_epoch(1492441716);
#[allow(clippy::unreadable_literal)]
let time = webpki::Time::from_seconds_since_unix_epoch(1492441716); // 2017-04-17T15:08:36Z

let cert = webpki::EndEntityCert::try_from(ee).unwrap();
assert_eq!(
Expand Down Expand Up @@ -113,8 +113,8 @@ pub fn wpt() {
let anchors = vec![webpki::TrustAnchor::try_from_cert_der(ca).unwrap()];
let anchors = webpki::TlsServerTrustAnchors(&anchors);

#[allow(clippy::unreadable_literal)] // TODO: Make this clear.
let time = webpki::Time::from_seconds_since_unix_epoch(1619256684);
#[allow(clippy::unreadable_literal)]
let time = webpki::Time::from_seconds_since_unix_epoch(1619256684); // 2021-04-24T09:31:24Z

let cert = webpki::EndEntityCert::try_from(ee).unwrap();
assert_eq!(
Expand All @@ -131,8 +131,8 @@ pub fn ed25519() {
let anchors = vec![webpki::TrustAnchor::try_from_cert_der(ca).unwrap()];
let anchors = webpki::TlsServerTrustAnchors(&anchors);

#[allow(clippy::unreadable_literal)] // TODO: Make this clear.
let time = webpki::Time::from_seconds_since_unix_epoch(1547363522);
#[allow(clippy::unreadable_literal)]
let time = webpki::Time::from_seconds_since_unix_epoch(1547363522); // 2019-01-13T07:12:02Z

let cert = webpki::EndEntityCert::try_from(ee).unwrap();
assert_eq!(
Expand Down

0 comments on commit d986ba0

Please sign in to comment.