From d2df647238be5803f851a0ef184573f8b8833323 Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Mon, 23 Sep 2024 14:13:03 +0900 Subject: [PATCH] feat: Change to use `core::error::Error` --- .clippy.toml | 2 +- .github/workflows/build.yaml | 4 ++-- .github/workflows/powerset.yaml | 2 +- README.md | 2 +- time-core/Cargo.toml | 2 +- time-macros/Cargo.toml | 2 +- time/Cargo.toml | 2 +- time/src/error/component_range.rs | 4 +--- time/src/error/conversion_range.rs | 4 +--- time/src/error/different_variant.rs | 4 +--- time/src/error/format.rs | 6 ++---- time/src/error/indeterminate_offset.rs | 4 +--- time/src/error/invalid_format_description.rs | 4 +--- time/src/error/invalid_variant.rs | 4 +--- time/src/error/mod.rs | 6 ++---- time/src/error/parse.rs | 6 ++---- time/src/error/parse_from_description.rs | 4 +--- time/src/error/try_from_parsed.rs | 6 ++---- 18 files changed, 23 insertions(+), 45 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 87702c79e..f483e4b86 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,4 +1,4 @@ -msrv = "1.67" +msrv = "1.81" missing-docs-in-crate-items = true disallowed-macros = [ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dca25cc65..9af5b7ade 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,7 +51,7 @@ jobs: strategy: matrix: rust: - - { version: "1.67.0", name: MSRV } + - { version: "1.81.0", name: MSRV } - { version: stable, name: stable } kind: - name: no_std @@ -147,7 +147,7 @@ jobs: strategy: matrix: rust: - - { version: "1.67.0", name: MSRV } + - { version: "1.81.0", name: MSRV } - { version: stable, name: stable } os: - { name: Ubuntu, value: ubuntu-latest } diff --git a/.github/workflows/powerset.yaml b/.github/workflows/powerset.yaml index 479c036bf..556db5035 100644 --- a/.github/workflows/powerset.yaml +++ b/.github/workflows/powerset.yaml @@ -49,7 +49,7 @@ jobs: strategy: matrix: rust: - - { version: "1.67.0", name: MSRV } + - { version: "1.81.0", name: MSRV } - { version: stable, name: stable } kind: - name: no_std diff --git a/README.md b/README.md index b2991f93d..87bac1e3e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # time -[![minimum rustc: 1.67](https://img.shields.io/badge/minimum%20rustc-1.67-yellowgreen?logo=rust&style=flat-square)](https://www.whatrustisit.com) +[![minimum rustc: 1.81](https://img.shields.io/badge/minimum%20rustc-1.81-yellowgreen?logo=rust&style=flat-square)](https://www.whatrustisit.com) [![version](https://img.shields.io/crates/v/time?color=blue&logo=rust&style=flat-square)](https://crates.io/crates/time) [![build status](https://img.shields.io/github/actions/workflow/status/time-rs/time/build.yaml?branch=main&style=flat-square)](https://github.com/time-rs/time/actions) [![codecov](https://codecov.io/gh/time-rs/time/branch/main/graph/badge.svg?token=yt4XSmQNKQ)](https://codecov.io/gh/time-rs/time) diff --git a/time-core/Cargo.toml b/time-core/Cargo.toml index c11597177..34eefa3de 100644 --- a/time-core/Cargo.toml +++ b/time-core/Cargo.toml @@ -3,7 +3,7 @@ name = "time-core" version = "0.1.2" authors = ["Jacob Pratt ", "Time contributors"] edition = "2021" -rust-version = "1.67.0" +rust-version = "1.81.0" repository = "https://github.com/time-rs/time" keywords = ["date", "time", "calendar", "duration"] categories = ["date-and-time"] diff --git a/time-macros/Cargo.toml b/time-macros/Cargo.toml index 3451de834..784c04e52 100644 --- a/time-macros/Cargo.toml +++ b/time-macros/Cargo.toml @@ -3,7 +3,7 @@ name = "time-macros" version = "0.2.18" authors = ["Jacob Pratt ", "Time contributors"] edition = "2021" -rust-version = "1.67.0" +rust-version = "1.81.0" repository = "https://github.com/time-rs/time" keywords = ["date", "time", "calendar", "duration"] categories = ["date-and-time"] diff --git a/time/Cargo.toml b/time/Cargo.toml index 00f46f457..d1fd732e2 100644 --- a/time/Cargo.toml +++ b/time/Cargo.toml @@ -3,7 +3,7 @@ name = "time" version = "0.3.36" authors = ["Jacob Pratt ", "Time contributors"] edition = "2021" -rust-version = "1.67.0" +rust-version = "1.81.0" repository = "https://github.com/time-rs/time" homepage = "https://time-rs.github.io" keywords = ["date", "time", "calendar", "duration"] diff --git a/time/src/error/component_range.rs b/time/src/error/component_range.rs index 8a6e605ed..9310df08f 100644 --- a/time/src/error/component_range.rs +++ b/time/src/error/component_range.rs @@ -88,6 +88,4 @@ impl ComponentRange { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for ComponentRange {} +impl core::error::Error for ComponentRange {} diff --git a/time/src/error/conversion_range.rs b/time/src/error/conversion_range.rs index c97c4db2d..7100dfa7a 100644 --- a/time/src/error/conversion_range.rs +++ b/time/src/error/conversion_range.rs @@ -15,9 +15,7 @@ impl fmt::Display for ConversionRange { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for ConversionRange {} +impl core::error::Error for ConversionRange {} impl From for crate::Error { fn from(err: ConversionRange) -> Self { diff --git a/time/src/error/different_variant.rs b/time/src/error/different_variant.rs index 873eb489e..e030925b4 100644 --- a/time/src/error/different_variant.rs +++ b/time/src/error/different_variant.rs @@ -13,9 +13,7 @@ impl fmt::Display for DifferentVariant { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for DifferentVariant {} +impl core::error::Error for DifferentVariant {} impl From for crate::Error { fn from(err: DifferentVariant) -> Self { diff --git a/time/src/error/format.rs b/time/src/error/format.rs index ad199baa5..367418e5f 100644 --- a/time/src/error/format.rs +++ b/time/src/error/format.rs @@ -54,10 +54,8 @@ impl TryFrom for io::Error { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for Format { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for Format { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match *self { Self::InsufficientTypeInformation | Self::InvalidComponent(_) => None, Self::StdIo(ref err) => Some(err), diff --git a/time/src/error/indeterminate_offset.rs b/time/src/error/indeterminate_offset.rs index 89f10b4a7..07025b6d2 100644 --- a/time/src/error/indeterminate_offset.rs +++ b/time/src/error/indeterminate_offset.rs @@ -14,9 +14,7 @@ impl fmt::Display for IndeterminateOffset { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for IndeterminateOffset {} +impl core::error::Error for IndeterminateOffset {} impl From for crate::Error { fn from(err: IndeterminateOffset) -> Self { diff --git a/time/src/error/invalid_format_description.rs b/time/src/error/invalid_format_description.rs index b2f5b7bda..66bf7c62d 100644 --- a/time/src/error/invalid_format_description.rs +++ b/time/src/error/invalid_format_description.rs @@ -124,6 +124,4 @@ impl fmt::Display for InvalidFormatDescription { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for InvalidFormatDescription {} +impl core::error::Error for InvalidFormatDescription {} diff --git a/time/src/error/invalid_variant.rs b/time/src/error/invalid_variant.rs index 7c2426b60..a5b3e8dca 100644 --- a/time/src/error/invalid_variant.rs +++ b/time/src/error/invalid_variant.rs @@ -13,9 +13,7 @@ impl fmt::Display for InvalidVariant { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for InvalidVariant {} +impl core::error::Error for InvalidVariant {} impl From for crate::Error { fn from(err: InvalidVariant) -> Self { diff --git a/time/src/error/mod.rs b/time/src/error/mod.rs index 8ee6b8481..47c197452 100644 --- a/time/src/error/mod.rs +++ b/time/src/error/mod.rs @@ -104,10 +104,8 @@ impl fmt::Display for Error { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for Error { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for Error { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match self { Self::ConversionRange(err) => Some(err), Self::ComponentRange(err) => Some(err), diff --git a/time/src/error/parse.rs b/time/src/error/parse.rs index adc625911..225817126 100644 --- a/time/src/error/parse.rs +++ b/time/src/error/parse.rs @@ -34,10 +34,8 @@ impl fmt::Display for Parse { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for Parse { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for Parse { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match self { Self::TryFromParsed(err) => Some(err), Self::ParseFromDescription(err) => Some(err), diff --git a/time/src/error/parse_from_description.rs b/time/src/error/parse_from_description.rs index 52a8a3e09..9e1a0907c 100644 --- a/time/src/error/parse_from_description.rs +++ b/time/src/error/parse_from_description.rs @@ -32,9 +32,7 @@ impl fmt::Display for ParseFromDescription { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for ParseFromDescription {} +impl core::error::Error for ParseFromDescription {} impl From for crate::Error { fn from(original: ParseFromDescription) -> Self { diff --git a/time/src/error/try_from_parsed.rs b/time/src/error/try_from_parsed.rs index f7a9fe49a..a284bfeb7 100644 --- a/time/src/error/try_from_parsed.rs +++ b/time/src/error/try_from_parsed.rs @@ -43,10 +43,8 @@ impl TryFrom for error::ComponentRange { } } -#[cfg(feature = "std")] -#[allow(clippy::std_instead_of_core)] -impl std::error::Error for TryFromParsed { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for TryFromParsed { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match self { Self::InsufficientInformation => None, Self::ComponentRange(err) => Some(err),