From a7fb429cdaecd5b10c00e0041fd1db6151cdb729 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 12 Aug 2022 17:53:24 +0200 Subject: [PATCH 1/4] Require iana-time-zone 0.1.44 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ed67d5e881..065126eec8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ serde = { version = "1.0.99", default-features = false, optional = true } pure-rust-locales = { version = "0.5.2", optional = true } criterion = { version = "0.3", optional = true } rkyv = {version = "0.7", optional = true} -iana-time-zone = { version = "0.1.41", optional = true, features = ["fallback"] } +iana-time-zone = { version = "0.1.44", optional = true, features = ["fallback"] } [target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies] wasm-bindgen = { version = "0.2", optional = true } From 7c276e4510e5b7b75ebe5ea9c459dbc3bb255b4d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 12 Aug 2022 17:53:35 +0200 Subject: [PATCH 2/4] Bump version number to 0.4.22 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 065126eec8..59abf99af3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chrono" -version = "0.4.21" +version = "0.4.22" description = "Date and time library for Rust" homepage = "https://github.com/chronotope/chrono" documentation = "https://docs.rs/chrono/" From 489debb64c9e35be2d1ec7f602d3a687bbcb2a8e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 12 Aug 2022 17:56:55 +0200 Subject: [PATCH 3/4] Apply clippy suggestions --- src/format/parsed.rs | 2 +- src/month.rs | 2 +- src/naive/date.rs | 2 +- src/naive/time/mod.rs | 3 +-- src/offset/local/tz_info/parser.rs | 2 +- src/offset/local/tz_info/rule.rs | 2 +- src/weekday.rs | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/format/parsed.rs b/src/format/parsed.rs index 6fcdd60e82..32c6c7afbf 100644 --- a/src/format/parsed.rs +++ b/src/format/parsed.rs @@ -22,7 +22,7 @@ use crate::{Datelike, Timelike}; /// /// - `to_*` methods try to make a concrete date and time value out of set fields. /// It fully checks any remaining out-of-range conditions and inconsistent/impossible fields. -#[derive(Clone, PartialEq, Debug, Default)] +#[derive(Clone, PartialEq, Eq, Debug, Default)] pub struct Parsed { /// Year. /// diff --git a/src/month.rs b/src/month.rs index 6490abfd8b..e8a54bf879 100644 --- a/src/month.rs +++ b/src/month.rs @@ -201,7 +201,7 @@ impl Months { } /// An error resulting from reading `` value with `FromStr`. -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Eq)] pub struct ParseMonthError { pub(crate) _dummy: (), } diff --git a/src/naive/date.rs b/src/naive/date.rs index dfe3598319..0c17a79b4e 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -207,7 +207,7 @@ fn test_date_bounds() { impl NaiveDate { /// Makes a new `NaiveDate` from year and packed ordinal-flags, with a verification. fn from_of(year: i32, of: Of) -> Option { - if year >= MIN_YEAR && year <= MAX_YEAR && of.valid() { + if (MIN_YEAR..=MAX_YEAR).contains(&year) && of.valid() { let Of(of) = of; Some(NaiveDate { ymdf: (year << 13) | (of as DateImpl) }) } else { diff --git a/src/naive/time/mod.rs b/src/naive/time/mod.rs index a810c727b8..f882ccd454 100644 --- a/src/naive/time/mod.rs +++ b/src/naive/time/mod.rs @@ -536,7 +536,6 @@ impl NaiveTime { /// assert_eq!(from_hms(3, 4, 5).overflowing_add_signed(Duration::hours(-7)), /// (from_hms(20, 4, 5), -86_400)); /// ``` - #[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))] pub fn overflowing_add_signed(&self, mut rhs: OldDuration) -> (NaiveTime, i64) { let mut secs = self.secs; let mut frac = self.frac; @@ -585,7 +584,7 @@ impl NaiveTime { frac -= 1_000_000_000; secs += 1; } - debug_assert!(-86_400 <= secs && secs < 2 * 86_400); + debug_assert!((-86_400..2 * 86_400).contains(&secs)); debug_assert!((0..1_000_000_000).contains(&frac)); if secs < 0 { diff --git a/src/offset/local/tz_info/parser.rs b/src/offset/local/tz_info/parser.rs index dfbcf7c2df..77f8e481b5 100644 --- a/src/offset/local/tz_info/parser.rs +++ b/src/offset/local/tz_info/parser.rs @@ -229,7 +229,7 @@ impl<'a> Cursor<'a> { } pub(crate) fn peek(&self) -> Option<&u8> { - self.remaining().get(0) + self.remaining().first() } /// Returns remaining data diff --git a/src/offset/local/tz_info/rule.rs b/src/offset/local/tz_info/rule.rs index 69f6264e7a..7befddb5cf 100644 --- a/src/offset/local/tz_info/rule.rs +++ b/src/offset/local/tz_info/rule.rs @@ -399,7 +399,7 @@ fn parse_rule_time(cursor: &mut Cursor) -> Result { fn parse_rule_time_extended(cursor: &mut Cursor) -> Result { let (sign, hour, minute, second) = parse_signed_hhmmss(cursor)?; - if hour < -167 || hour > 167 { + if !(-167..=167).contains(&hour) { return Err(Error::InvalidTzString("invalid day time hour")); } if !(0..=59).contains(&minute) { diff --git a/src/weekday.rs b/src/weekday.rs index 03e06570ab..6d2603f5d1 100644 --- a/src/weekday.rs +++ b/src/weekday.rs @@ -186,7 +186,7 @@ impl num_traits::FromPrimitive for Weekday { } /// An error resulting from reading `Weekday` value with `FromStr`. -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Eq)] pub struct ParseWeekdayError { pub(crate) _dummy: (), } From 31843f1812178b3870167d9272438fdfd9fa0a8d Mon Sep 17 00:00:00 2001 From: Eric Sheppard Date: Sat, 13 Aug 2022 21:11:04 +1000 Subject: [PATCH 4/4] update changelog remove extra ] --- CHANGELOG.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be98bd3e33..f9fd981eea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,19 @@ breakage if you use `no-default-features`. There were/are numerous minor versions before 1.0 due to the language changes. Versions with only mechanical changes will be omitted from the following list. -## 0.4.20 (unreleased) +## 0.4.22 + +* Allow wasmbindgen to be optional on `wasm32-unknown-unknown` target [(#771)](https://github.com/chronotope/chrono/pull/771) +* Fix compile error for `x86_64-fortanix-unknown-sgx` [(#767)](https://github.com/chronotope/chrono/pull/767) +* Update `iana-time-zone` version to 1.44 [(#773)](https://github.com/chronotope/chrono/pull/773) + +## 0.4.21 + +* Fall back to UTC timezone in cases where no timezone is found [(#756)](https://github.com/chronotope/chrono/pull/756) +* Correctly detect timezone on Android [(#756)](https://github.com/chronotope/chrono/pull/756) +* Improve documentation for strftime `%Y` specifier [(#760)](https://github.com/chronotope/chrono/pull/760) + +## 0.4.20 * Add more formatting documentation and examples. * Add support for microseconds timestamps serde serialization/deserialization (#304)