From 7b667fc29b52392f4c47c07f0923c88847951b50 Mon Sep 17 00:00:00 2001 From: "David A. Ramos" Date: Fri, 8 Mar 2024 23:48:48 -0800 Subject: [PATCH] Set minimum version of chrono to 0.4.31 Newer versions of chrono have deprecated various functions, leading to compiler warnings. This diff migrates to the non-deprecated interface, which requires bumping the minimum version of `chrono` since that interface does't exist in older versions. --- Cargo-1.65.lock | 66 ++++++++++++++++++++++++++++++++++---------- Cargo.toml | 2 +- src/devicecode.rs | 3 +- src/introspection.rs | 8 +++--- 4 files changed, 58 insertions(+), 21 deletions(-) diff --git a/Cargo-1.65.lock b/Cargo-1.65.lock index 08698c8..6b8d1ae 100644 --- a/Cargo-1.65.lock +++ b/Cargo-1.65.lock @@ -17,6 +17,21 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.80" @@ -269,17 +284,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ + "android-tzdata", + "iana-time-zone", "js-sys", - "libc", - "num-integer", "num-traits", "serde", "wasm-bindgen", - "winapi", + "windows-targets 0.52.4", ] [[package]] @@ -757,6 +772,29 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.5.0" @@ -932,15 +970,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.18" @@ -1935,6 +1964,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 10deeff..9e1cf8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ serde_json = "1.0" sha2 = "0.10" ureq = { version = "2", optional = true } url = { version = "2.1", features = ["serde"] } -chrono = { version = "0.4", default-features = false, features = ["clock", "serde", "std", "wasmbind"] } +chrono = { version = "0.4.31", default-features = false, features = ["clock", "serde", "std", "wasmbind"] } serde_path_to_error = "0.1.2" [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/src/devicecode.rs b/src/devicecode.rs index 93ca519..b188175 100644 --- a/src/devicecode.rs +++ b/src/devicecode.rs @@ -889,8 +889,7 @@ mod tests { } fn next(&mut self) -> DateTime { let next_value = self.times.next().unwrap(); - let naive = chrono::NaiveDateTime::from_timestamp(next_value, 0); - DateTime::::from_utc(naive, chrono::Utc) + DateTime::from_timestamp(next_value, 0).unwrap() } } diff --git a/src/introspection.rs b/src/introspection.rs index 5ffb353..12c959d 100644 --- a/src/introspection.rs +++ b/src/introspection.rs @@ -457,7 +457,7 @@ mod tests { use crate::tests::{mock_http_client, new_client}; use crate::{AccessToken, AuthType, ClientId, IntrospectionUrl, RedirectUrl, Scope}; - use chrono::{TimeZone, Utc}; + use chrono::DateTime; use http::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE}; use http::{HeaderValue, Response, StatusCode}; @@ -577,15 +577,15 @@ mod tests { introspection_response.token_type ); assert_eq!( - Some(Utc.timestamp(1604073517, 0)), + Some(DateTime::from_timestamp(1604073517, 0).unwrap()), introspection_response.exp ); assert_eq!( - Some(Utc.timestamp(1604073217, 0)), + Some(DateTime::from_timestamp(1604073217, 0).unwrap()), introspection_response.iat ); assert_eq!( - Some(Utc.timestamp(1604073317, 0)), + Some(DateTime::from_timestamp(1604073317, 0).unwrap()), introspection_response.nbf ); assert_eq!(Some("demo".to_string()), introspection_response.sub);