Skip to content

Commit

Permalink
Set minimum version of chrono to 0.4.31
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ramosbugs committed Mar 21, 2024
1 parent db0ea44 commit 7b667fc
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 21 deletions.
66 changes: 52 additions & 14 deletions Cargo-1.65.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions src/devicecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,7 @@ mod tests {
}
fn next(&mut self) -> DateTime<Utc> {
let next_value = self.times.next().unwrap();
let naive = chrono::NaiveDateTime::from_timestamp(next_value, 0);
DateTime::<Utc>::from_utc(naive, chrono::Utc)
DateTime::from_timestamp(next_value, 0).unwrap()
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/introspection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7b667fc

Please sign in to comment.