From 66ca1510e7a6ce66f2ccaabb17e469f3364bea8f Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 28 Sep 2024 11:21:40 -0600 Subject: [PATCH] crypto-common: use `core::error::Error` trait; MSRV 1.81 (#1660) The `core::error::Error` trait is now stable, meaning we no longer need to gate impls for it on a `std` feature. --- .github/workflows/crypto-common.yml | 12 ++++++------ crypto-common/Cargo.toml | 2 +- crypto-common/README.md | 4 ++-- crypto-common/src/hazmat.rs | 3 +-- crypto-common/src/lib.rs | 6 +----- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/crypto-common.yml b/.github/workflows/crypto-common.yml index efb87ad4..0f53a686 100644 --- a/.github/workflows/crypto-common.yml +++ b/.github/workflows/crypto-common.yml @@ -2,9 +2,9 @@ name: crypto-common on: pull_request: - paths: - - "crypto-common/**" - - "Cargo.*" + paths: + - "crypto-common/**" + - "Cargo.*" push: branches: master @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.81.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -39,14 +39,14 @@ jobs: minimal-versions: uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: - working-directory: ${{ github.workflow }} + working-directory: ${{ github.workflow }} test: runs-on: ubuntu-latest strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.81.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/crypto-common/Cargo.toml b/crypto-common/Cargo.toml index 52be3f26..a7ae02d8 100644 --- a/crypto-common/Cargo.toml +++ b/crypto-common/Cargo.toml @@ -6,7 +6,7 @@ authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" readme = "README.md" edition = "2021" -rust-version = "1.65" +rust-version = "1.81" documentation = "https://docs.rs/crypto-common" repository = "https://github.com/RustCrypto/traits" keywords = ["crypto", "traits"] diff --git a/crypto-common/README.md b/crypto-common/README.md index 21008623..2197b409 100644 --- a/crypto-common/README.md +++ b/crypto-common/README.md @@ -14,7 +14,7 @@ higher-level trait crates instead of this one. ## Minimum Supported Rust Version -Rust **1.65** or higher. +Rust **1.81** or higher. Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump. @@ -46,7 +46,7 @@ dual licensed as above, without any additional terms or conditions. [docs-image]: https://docs.rs/crypto-common/badge.svg [docs-link]: https://docs.rs/crypto-common/ [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.65+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg [chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg [chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260041-hashes [build-image]: https://github.com/RustCrypto/traits/workflows/crypto-common/badge.svg?branch=master&event=push diff --git a/crypto-common/src/hazmat.rs b/crypto-common/src/hazmat.rs index 735f485e..22672bee 100644 --- a/crypto-common/src/hazmat.rs +++ b/crypto-common/src/hazmat.rs @@ -24,8 +24,7 @@ impl fmt::Display for DeserializeStateError { } } -#[cfg(feature = "std")] -impl std::error::Error for DeserializeStateError {} +impl core::error::Error for DeserializeStateError {} /// Types which can serialize the internal state and be restored from it. /// diff --git a/crypto-common/src/lib.rs b/crypto-common/src/lib.rs index bd62fade..7721b86f 100644 --- a/crypto-common/src/lib.rs +++ b/crypto-common/src/lib.rs @@ -9,9 +9,6 @@ #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms, missing_debug_implementations)] -#[cfg(feature = "std")] -extern crate std; - /// Hazardous materials. pub mod hazmat; @@ -389,5 +386,4 @@ impl fmt::Display for InvalidLength { } } -#[cfg(feature = "std")] -impl std::error::Error for InvalidLength {} +impl core::error::Error for InvalidLength {}