From 1292b7d7d9f9750de5c6ddc2f7e552fbf752e8c4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 16 Sep 2023 13:57:57 -0400 Subject: [PATCH] Port to non-deprecated chrono APIs To silence clippy. --- src/model_legacy.rs | 2 +- src/util.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/model_legacy.rs b/src/model_legacy.rs index a584025e..0487d2dc 100644 --- a/src/model_legacy.rs +++ b/src/model_legacy.rs @@ -45,7 +45,7 @@ pub(crate) struct SavedState01 { impl ContentMetadata01 { pub(crate) fn upconvert(self) -> NewContentMetadata { - let timestamp = DateTime::::from_utc(self.timestamp, Utc); + let timestamp = self.timestamp.and_utc(); NewContentMetadata { timestamp, version: self.version, diff --git a/src/util.rs b/src/util.rs index 319796fe..90eed324 100644 --- a/src/util.rs +++ b/src/util.rs @@ -97,9 +97,10 @@ pub(crate) fn parse_rpm_metadata(stdout: Vec) -> Result { let parts: Vec<_> = s.splitn(2, ',').collect(); let name = parts[0]; if let Some(ts) = parts.get(1) { - let nt = NaiveDateTime::parse_from_str(ts, "%s") - .context("Failed to parse rpm buildtime")?; - Ok((name, DateTime::::from_utc(nt, Utc))) + let nt = DateTime::parse_from_str(ts, "%s") + .context("Failed to parse rpm buildtime")? + .with_timezone(&chrono::Utc); + Ok((name, nt)) } else { bail!("Failed to parse: {}", s); }