Skip to content

Commit

Permalink
feat: Change to use core::error::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Sep 23, 2024
1 parent 2e68a36 commit d2df647
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msrv = "1.67"
msrv = "1.81"

missing-docs-in-crate-items = true
disallowed-macros = [
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/powerset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion time-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "time-core"
version = "0.1.2"
authors = ["Jacob Pratt <[email protected]>", "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"]
Expand Down
2 changes: 1 addition & 1 deletion time-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "time-macros"
version = "0.2.18"
authors = ["Jacob Pratt <[email protected]>", "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"]
Expand Down
2 changes: 1 addition & 1 deletion time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "time"
version = "0.3.36"
authors = ["Jacob Pratt <[email protected]>", "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"]
Expand Down
4 changes: 1 addition & 3 deletions time/src/error/component_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
4 changes: 1 addition & 3 deletions time/src/error/conversion_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConversionRange> for crate::Error {
fn from(err: ConversionRange) -> Self {
Expand Down
4 changes: 1 addition & 3 deletions time/src/error/different_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DifferentVariant> for crate::Error {
fn from(err: DifferentVariant) -> Self {
Expand Down
6 changes: 2 additions & 4 deletions time/src/error/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ impl TryFrom<Format> 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),
Expand Down
4 changes: 1 addition & 3 deletions time/src/error/indeterminate_offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IndeterminateOffset> for crate::Error {
fn from(err: IndeterminateOffset) -> Self {
Expand Down
4 changes: 1 addition & 3 deletions time/src/error/invalid_format_description.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
4 changes: 1 addition & 3 deletions time/src/error/invalid_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<InvalidVariant> for crate::Error {
fn from(err: InvalidVariant) -> Self {
Expand Down
6 changes: 2 additions & 4 deletions time/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 2 additions & 4 deletions time/src/error/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 1 addition & 3 deletions time/src/error/parse_from_description.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParseFromDescription> for crate::Error {
fn from(original: ParseFromDescription) -> Self {
Expand Down
6 changes: 2 additions & 4 deletions time/src/error/try_from_parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ impl TryFrom<TryFromParsed> 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),
Expand Down

0 comments on commit d2df647

Please sign in to comment.