Skip to content

Commit

Permalink
cipher: use core::error; remove std feature
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tarcieri committed Oct 8, 2024
1 parent 5acedcd commit ec4bddf
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cipher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion cipher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 0 additions & 2 deletions cipher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions cipher/src/stream/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -37,5 +36,4 @@ impl From<OverflowError> for StreamCipherError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for OverflowError {}
impl core::error::Error for OverflowError {}

0 comments on commit ec4bddf

Please sign in to comment.