From ec4bddf31c0c661fac286e736d11d39e89f7c4c6 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Tue, 8 Oct 2024 14:38:12 -0600 Subject: [PATCH] cipher: use `core::error`; remove `std` feature Switches from `std::error::Error` to `core::error::Error` which was stabilized in Rust 1.81, which is already the `cipher` crate's current MSRV. Since this was the only usage of `std`, also removes the `std` feature. --- .github/workflows/cipher.yml | 1 - cipher/Cargo.toml | 1 - cipher/src/lib.rs | 2 -- cipher/src/stream/errors.rs | 6 ++---- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cipher.yml b/.github/workflows/cipher.yml index 0c1d3d176..28e2eb6bf 100644 --- a/.github/workflows/cipher.yml +++ b/.github/workflows/cipher.yml @@ -69,5 +69,4 @@ jobs: - run: cargo test - run: cargo test --features block-padding - run: cargo test --features dev - - run: cargo test --features std - run: cargo test --all-features diff --git a/cipher/Cargo.toml b/cipher/Cargo.toml index c0a87c0d4..95c239f7a 100644 --- a/cipher/Cargo.toml +++ b/cipher/Cargo.toml @@ -22,7 +22,6 @@ zeroize = { version = "1.8", optional = true, default-features = false } [features] alloc = [] -std = ["alloc"] block-padding = ["inout/block-padding"] # Enable random key and IV generation methods rand_core = ["crypto-common/rand_core"] diff --git a/cipher/src/lib.rs b/cipher/src/lib.rs index 1c7ae89ee..7e34bba0c 100644 --- a/cipher/src/lib.rs +++ b/cipher/src/lib.rs @@ -20,8 +20,6 @@ #[cfg(all(feature = "block-padding", feature = "alloc"))] extern crate alloc; -#[cfg(feature = "std")] -extern crate std; #[cfg(feature = "dev")] pub use blobby; diff --git a/cipher/src/stream/errors.rs b/cipher/src/stream/errors.rs index acd2f488a..e30576da6 100644 --- a/cipher/src/stream/errors.rs +++ b/cipher/src/stream/errors.rs @@ -17,8 +17,7 @@ impl fmt::Display for StreamCipherError { } } -#[cfg(feature = "std")] -impl std::error::Error for StreamCipherError {} +impl core::error::Error for StreamCipherError {} /// The error type returned when a cipher position can not be represented /// by the requested type. @@ -37,5 +36,4 @@ impl From for StreamCipherError { } } -#[cfg(feature = "std")] -impl std::error::Error for OverflowError {} +impl core::error::Error for OverflowError {}