From 73a5018a3ce609dbbee85922df57c2b43054ea87 Mon Sep 17 00:00:00 2001 From: Ameer Ghani Date: Tue, 12 Sep 2023 16:30:41 -0400 Subject: [PATCH] build(deps): Bump chrono from 0.4.26 to 0.4.30 and remove use of deprecated function (0.5 backport) (#1918) * build(deps): Bump chrono from 0.4.26 to 0.4.30 Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.26 to 0.4.30. - [Release notes](https://github.com/chronotope/chrono/releases) - [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md) - [Commits](https://github.com/chronotope/chrono/compare/v0.4.26...v0.4.30) --- updated-dependencies: - dependency-name: chrono dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Remove deprecated use of DateTime::from_utc --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 30 ++++++------------------------ collector/src/lib.rs | 39 ++++++++++++++------------------------- 2 files changed, 20 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97ca2267e..465b219a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -501,18 +501,17 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] @@ -1341,7 +1340,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -2434,7 +2433,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -4247,17 +4246,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.23" @@ -4613,7 +4601,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "time 0.3.23", + "time", "tracing-core", "tracing-subscriber", ] @@ -5009,12 +4997,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/collector/src/lib.rs b/collector/src/lib.rs index b80282e00..5aef85123 100644 --- a/collector/src/lib.rs +++ b/collector/src/lib.rs @@ -54,7 +54,7 @@ #![cfg_attr(docsrs, feature(doc_cfg))] use backoff::{backoff::Backoff, ExponentialBackoff}; -use chrono::{DateTime, Duration, Utc}; +use chrono::{DateTime, Duration, TimeZone, Utc}; use derivative::Derivative; use http_api_problem::HttpApiProblem; pub use janus_core::task::AuthenticationToken; @@ -551,10 +551,7 @@ impl Collector { partial_batch_selector: collect_response.partial_batch_selector().clone(), report_count: collect_response.report_count(), interval: ( - DateTime::::from_utc( - collect_response.interval().start().as_naive_date_time()?, - Utc, - ), + Utc.from_utc_datetime(&collect_response.interval().start().as_naive_date_time()?), collect_response .interval() .duration() @@ -664,7 +661,7 @@ mod tests { PollResult, }; use assert_matches::assert_matches; - use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; + use chrono::{NaiveDateTime, TimeZone, Utc}; #[cfg(feature = "fpvec_bounded_l2")] use fixed_macro::fixed; use janus_core::{ @@ -915,9 +912,8 @@ mod tests { PartialBatchSelector::new_time_interval(), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), - Utc + Utc.from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), ), chrono::Duration::seconds(3600), ), @@ -984,9 +980,8 @@ mod tests { PartialBatchSelector::new_time_interval(), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), - Utc + Utc.from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), ), chrono::Duration::seconds(3600), ), @@ -1052,9 +1047,8 @@ mod tests { PartialBatchSelector::new_time_interval(), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), - Utc + Utc.from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), ), chrono::Duration::seconds(3600), ), @@ -1129,9 +1123,8 @@ mod tests { PartialBatchSelector::new_time_interval(), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), - Utc + Utc.from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), ), chrono::Duration::seconds(3600), ), @@ -1199,10 +1192,7 @@ mod tests { PartialBatchSelector::new_fixed_size(batch_id), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(0, 0).unwrap(), - Utc - ), + Utc.from_utc_datetime(&NaiveDateTime::from_timestamp_opt(0, 0).unwrap()), chrono::Duration::seconds(1), ), 1 @@ -1280,9 +1270,8 @@ mod tests { PartialBatchSelector::new_time_interval(), 1, ( - DateTime::::from_utc( - NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), - Utc + Utc.from_utc_datetime( + &NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(), ), chrono::Duration::seconds(3600), ),