Skip to content

Commit

Permalink
Port to non-deprecated chrono APIs
Browse files Browse the repository at this point in the history
To silence clippy.
  • Loading branch information
cgwalters committed Sep 16, 2023
1 parent 6f28a49 commit 49e5326
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/model_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub(crate) struct SavedState01 {

impl ContentMetadata01 {
pub(crate) fn upconvert(self) -> NewContentMetadata {
let timestamp = DateTime::<Utc>::from_utc(self.timestamp, Utc);
let timestamp = self.timestamp.and_utc();
NewContentMetadata {
timestamp,
version: self.version,
Expand Down
7 changes: 4 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ pub(crate) fn parse_rpm_metadata(stdout: Vec<u8>) -> Result<ContentMetadata> {
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::<Utc>::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);
}
Expand Down

0 comments on commit 49e5326

Please sign in to comment.