diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 71867ae..2f70d63 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -24,7 +24,7 @@ jobs: - aarch64-apple-darwin - x86_64-pc-windows-msvc toolchain: - - 1.74.0 # MSRV + - 1.81.0 # MSRV - stable - nightly include: diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a0fb20b..7350d20 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -14,6 +14,13 @@ All notable changes to this project will be documented in this file. The format is based on https://keepachangelog.com/[Keep a Changelog], and this project adheres to https://semver.org/[Semantic Versioning]. +== {compare-url}/v0.8.1\...HEAD[Unreleased] + +=== Changed + +* Make `Error` trait available in `no_std` mode ({pull-request-url}/114[#114]) +* Bump MSRV to 1.81.0 ({pull-request-url}/114[#114]) + == {compare-url}/v0.8.0\...v0.8.1[0.8.1] - 2024-07-03 === Changed diff --git a/Cargo.toml b/Cargo.toml index 52dd731..696706b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ name = "sysexits" version = "0.8.1" authors = ["Shun Sakai "] edition = "2021" -rust-version = "1.74.0" +rust-version = "1.81.0" description = "The system exit codes as defined by " documentation = "https://docs.rs/sysexits" readme = "README.md" diff --git a/README.md b/README.md index d19801e..f25b7bd 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ See the [documentation][docs-url] for more details. ## Minimum supported Rust version -The minimum supported Rust version (MSRV) of this library is v1.74.0. +The minimum supported Rust version (MSRV) of this library is v1.81.0. ## Source code diff --git a/clippy.toml b/clippy.toml index efb0e67..c037fdb 100644 --- a/clippy.toml +++ b/clippy.toml @@ -2,4 +2,4 @@ # # SPDX-License-Identifier: Apache-2.0 OR MIT -msrv = "1.74.0" +msrv = "1.81.0" diff --git a/src/error.rs b/src/error.rs index f3f6cc1..e7eff0c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,7 +5,7 @@ //! Error types for this crate. -use core::fmt; +use core::{error::Error, fmt}; /// The error type indicating that [`ExitCode`](crate::ExitCode) was out of /// range. @@ -19,8 +19,7 @@ impl fmt::Display for ExitCodeRangeError { } } -#[cfg(feature = "std")] -impl std::error::Error for ExitCodeRangeError {} +impl Error for ExitCodeRangeError {} #[cfg(feature = "std")] /// An error which can be returned when converting an @@ -59,7 +58,7 @@ impl fmt::Display for TryFromExitStatusError { } #[cfg(feature = "std")] -impl std::error::Error for TryFromExitStatusError {} +impl Error for TryFromExitStatusError {} #[cfg(test)] mod tests { @@ -95,11 +94,8 @@ mod tests { ); } - #[cfg(feature = "std")] #[test] fn source_exit_code_range_error() { - use std::error::Error; - assert!(ExitCodeRangeError.source().is_none()); } @@ -188,8 +184,6 @@ mod tests { #[cfg(feature = "std")] #[test] fn source_try_from_exit_status_error() { - use std::error::Error; - assert!(TryFromExitStatusError::new(Some(1)).source().is_none()); assert!(TryFromExitStatusError::new(None).source().is_none()); } diff --git a/src/exit_code.rs b/src/exit_code.rs index e380b67..b744ae9 100644 --- a/src/exit_code.rs +++ b/src/exit_code.rs @@ -10,7 +10,7 @@ mod convert; pub mod result; -use core::fmt; +use core::{error::Error, fmt}; /// `ExitCode` is a type that represents the system exit code constants as /// defined by [``]. @@ -287,8 +287,7 @@ impl fmt::Display for ExitCode { } } -#[cfg(feature = "std")] -impl std::error::Error for ExitCode {} +impl Error for ExitCode {} #[cfg(feature = "std")] impl std::process::Termination for ExitCode { @@ -663,11 +662,8 @@ mod tests { assert!(ExitCode::Config.is_failure()); } - #[cfg(feature = "std")] #[test] fn source_exit_code() { - use std::error::Error; - assert!(ExitCode::Ok.source().is_none()); assert!(ExitCode::Usage.source().is_none()); assert!(ExitCode::DataErr.source().is_none());