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), ),