From 50151b7688423f44b3351b236de437adb7be524e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 25 Oct 2023 19:07:56 +0200 Subject: [PATCH] copyright: fix chrono deprecation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and use the recommended alternative. it has been deprecated since chrono 0.4.27[0] 0: https://github.com/chronotope/chrono/releases/tag/v0.4.27 1: https://github.com/chronotope/chrono/pull/1175 Signed-off-by: Fabian Grünbichler --- src/debian/copyright.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/debian/copyright.rs b/src/debian/copyright.rs index 07bc238..35ee0d3 100644 --- a/src/debian/copyright.rs +++ b/src/debian/copyright.rs @@ -1,5 +1,5 @@ use cargo::core::manifest; -use chrono::{DateTime, Datelike, NaiveDateTime, Utc}; +use chrono::{Datelike, NaiveDateTime, TimeZone, Utc}; use git2::Repository; use regex; use tempfile; @@ -318,19 +318,19 @@ fn copyright_fromgit(repo_url: &str) -> Result { let first_commit = repo.find_commit(first_id)?; let latest_commit = repo.find_commit(latest_id)?; - let first_year = DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(first_commit.time().seconds(), 0) - .ok_or(anyhow::Error::msg("lo"))?, - Utc, - ) - .year(); - - let latest_year = DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(latest_commit.time().seconds(), 0) - .ok_or(anyhow::Error::msg("lo"))?, - Utc, - ) - .year(); + let first_year = Utc + .from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(first_commit.time().seconds(), 0) + .ok_or(anyhow::Error::msg("lo"))?, + ) + .year(); + + let latest_year = Utc + .from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(latest_commit.time().seconds(), 0) + .ok_or(anyhow::Error::msg("lo"))?, + ) + .year(); let notice = match first_year.cmp(&latest_year) { Ordering::Equal => format!("{}", first_year),