Skip to content

Commit ab0c802

Browse files
authored
block-padding+inout: remove std feature (#1117)
Leverages the `error_in_core` feature stabilized in Rust 1.81 to allow `Error` trait impls in `no_std` contexts. This was the only dependency on `std`, so this also removes the `std` feature, which is no longer necessary.
1 parent 021e014 commit ab0c802

5 files changed

Lines changed: 5 additions & 36 deletions

File tree

‎block-padding/Cargo.toml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ readme = "README.md"
1414

1515
[dependencies]
1616
hybrid-array = "0.2.0-rc.10"
17-
18-
[features]
19-
std = []
20-
21-
[package.metadata.docs.rs]
22-
all-features = true
23-
rustdoc-args = ["--cfg", "docsrs"]

‎block-padding/src/lib.rs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
99
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
1010
)]
11-
#![cfg_attr(docsrs, feature(doc_cfg))]
1211
#![warn(missing_docs, rust_2018_idioms)]
1312

14-
#[cfg(feature = "std")]
15-
extern crate std;
16-
1713
pub use hybrid_array as array;
1814

1915
use core::fmt;
@@ -399,6 +395,4 @@ impl fmt::Display for UnpadError {
399395
}
400396
}
401397

402-
#[cfg(feature = "std")]
403-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
404-
impl std::error::Error for UnpadError {}
398+
impl core::error::Error for UnpadError {}

‎inout/Cargo.toml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ readme = "README.md"
1414
[dependencies]
1515
block-padding = { version = "0.4.0-rc.0", path = "../block-padding", optional = true }
1616
hybrid-array = "0.2.0-rc.10"
17-
18-
[features]
19-
std = ["block-padding/std"]
20-
21-
[package.metadata.docs.rs]
22-
all-features = true
23-
rustdoc-args = ["--cfg", "docsrs"]

‎inout/src/errors.rs‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ impl fmt::Display for IntoArrayError {
1010
}
1111
}
1212

13-
#[cfg(feature = "std")]
14-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
15-
impl std::error::Error for IntoArrayError {}
13+
impl core::error::Error for IntoArrayError {}
1614

1715
/// The error returned when input and output slices have different length
1816
/// and thus can not be converted to `InOutBuf`.
@@ -25,9 +23,7 @@ impl fmt::Display for NotEqualError {
2523
}
2624
}
2725

28-
#[cfg(feature = "std")]
29-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
30-
impl std::error::Error for NotEqualError {}
26+
impl core::error::Error for NotEqualError {}
3127

3228
/// Padding error. Usually emitted when size of output buffer is insufficient.
3329
#[cfg(feature = "block-padding")]
@@ -43,9 +39,7 @@ impl fmt::Display for PadError {
4339
}
4440

4541
#[cfg(feature = "block-padding")]
46-
#[cfg(feature = "std")]
47-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
48-
impl std::error::Error for PadError {}
42+
impl core::error::Error for PadError {}
4943

5044
/// Output buffer is smaller than input buffer.
5145
#[derive(Clone, Copy, Debug)]
@@ -57,6 +51,4 @@ impl fmt::Display for OutIsTooSmallError {
5751
}
5852
}
5953

60-
#[cfg(feature = "std")]
61-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
62-
impl std::error::Error for OutIsTooSmallError {}
54+
impl core::error::Error for OutIsTooSmallError {}

‎inout/src/lib.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#![cfg_attr(docsrs, feature(doc_cfg))]
1111
#![warn(missing_docs, rust_2018_idioms)]
1212

13-
#[cfg(feature = "std")]
14-
extern crate std;
15-
1613
#[cfg(feature = "block-padding")]
1714
#[cfg_attr(docsrs, doc(cfg(feature = "block-padding")))]
1815
pub use block_padding;

0 commit comments

Comments
 (0)