Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Apr 5, 2024
1 parent e8f72a6 commit 0d37925
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chrono-tz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include = [

[dependencies]
arbitrary = { version = "1.2", optional = true, features = ["derive"] }
chrono = { version = "0.4.24", default-features = false }
chrono = { version = "0.4.25", default-features = false }
serde = { version = "1.0.99", optional = true, default-features = false }
phf = { version = "0.11", default-features = false }
uncased = { version = "0.9", optional = true, default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions chrono-tz/src/timezone_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl TimeZone for Tz {
// First search for a timespan that the local datetime falls into, then, if it exists,
// check the two surrounding timespans (if they exist) to see if there is any ambiguity.
fn offset_from_local_datetime(&self, local: &NaiveDateTime) -> LocalResult<Self::Offset> {
let timestamp = local.timestamp();
let timestamp = local.and_utc().timestamp();
let timespans = self.timespans();
let index = binary_search(0, timespans.len(), |i| timespans.local_span(i).cmp(timestamp));
TzOffset::map_localresult(
Expand Down Expand Up @@ -360,8 +360,8 @@ impl TimeZone for Tz {

// Binary search for the required timespan. Any i64 is guaranteed to fall within
// exactly one timespan, no matter what (so the `unwrap` is safe).
fn offset_from_utc_datetime(&self, utc: &NaiveDateTime) -> Self::Offset {
let timestamp = utc.timestamp();
fn offset_from_utc_datetime(&self, dt: &NaiveDateTime) -> Self::Offset {
let timestamp = dt.and_utc().timestamp();
let timespans = self.timespans();
let index =
binary_search(0, timespans.len(), |i| timespans.utc_span(i).cmp(timestamp)).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion chrono-tz/tests/check-regex-filtering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod tests {
fn london_compiles() {
// This line will be a compilation failure if the code generation
// mistakenly excluded Europe::London.
let _london_time = London.ymd(2013, 12, 25).and_hms(14, 0, 0);
let _london_time = London.with_ymd_and_hms(2013, 12, 25, 14, 0, 0);
assert_eq!("Europe/London", London.name());

// Since London is included, converting from the corresponding
Expand Down

0 comments on commit 0d37925

Please sign in to comment.