From 885f64a84fca5c18e0ced1a6e28116b9748af460 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 28 Sep 2024 11:28:59 -0600 Subject: [PATCH 1/2] block_padding+inout: remove `std` feature 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. --- block-padding/Cargo.toml | 3 --- block-padding/src/lib.rs | 8 +------- inout/Cargo.toml | 3 --- inout/src/errors.rs | 16 ++++------------ inout/src/lib.rs | 3 --- 5 files changed, 5 insertions(+), 28 deletions(-) diff --git a/block-padding/Cargo.toml b/block-padding/Cargo.toml index 20afeea8..867f719f 100644 --- a/block-padding/Cargo.toml +++ b/block-padding/Cargo.toml @@ -15,9 +15,6 @@ readme = "README.md" [dependencies] hybrid-array = "0.2.0-rc.10" -[features] -std = [] - [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] diff --git a/block-padding/src/lib.rs b/block-padding/src/lib.rs index 28aa4775..b0e16ef9 100644 --- a/block-padding/src/lib.rs +++ b/block-padding/src/lib.rs @@ -8,12 +8,8 @@ html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" )] -#![cfg_attr(docsrs, feature(doc_cfg))] #![warn(missing_docs, rust_2018_idioms)] -#[cfg(feature = "std")] -extern crate std; - pub use hybrid_array as array; use core::fmt; @@ -399,6 +395,4 @@ impl fmt::Display for UnpadError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for UnpadError {} +impl core::error::Error for UnpadError {} diff --git a/inout/Cargo.toml b/inout/Cargo.toml index ac61e812..45b4c7c5 100644 --- a/inout/Cargo.toml +++ b/inout/Cargo.toml @@ -15,9 +15,6 @@ readme = "README.md" block-padding = { version = "0.4.0-rc.0", path = "../block-padding", optional = true } hybrid-array = "0.2.0-rc.10" -[features] -std = ["block-padding/std"] - [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] diff --git a/inout/src/errors.rs b/inout/src/errors.rs index be61a780..ecbf265c 100644 --- a/inout/src/errors.rs +++ b/inout/src/errors.rs @@ -10,9 +10,7 @@ impl fmt::Display for IntoArrayError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for IntoArrayError {} +impl core::error::Error for IntoArrayError {} /// The error returned when input and output slices have different length /// and thus can not be converted to `InOutBuf`. @@ -25,9 +23,7 @@ impl fmt::Display for NotEqualError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for NotEqualError {} +impl core::error::Error for NotEqualError {} /// Padding error. Usually emitted when size of output buffer is insufficient. #[cfg(feature = "block-padding")] @@ -43,9 +39,7 @@ impl fmt::Display for PadError { } #[cfg(feature = "block-padding")] -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for PadError {} +impl core::error::Error for PadError {} /// Output buffer is smaller than input buffer. #[derive(Clone, Copy, Debug)] @@ -57,6 +51,4 @@ impl fmt::Display for OutIsTooSmallError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for OutIsTooSmallError {} +impl core::error::Error for OutIsTooSmallError {} diff --git a/inout/src/lib.rs b/inout/src/lib.rs index cb5dc4b1..bc4ecb55 100644 --- a/inout/src/lib.rs +++ b/inout/src/lib.rs @@ -10,9 +10,6 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![warn(missing_docs, rust_2018_idioms)] -#[cfg(feature = "std")] -extern crate std; - #[cfg(feature = "block-padding")] #[cfg_attr(docsrs, doc(cfg(feature = "block-padding")))] pub use block_padding; From 35b9d9bf807df26334ff924b40e54858bef68ae1 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 28 Sep 2024 12:19:11 -0600 Subject: [PATCH 2/2] Cargo.toml: remove `package.metadata.docs.rs` sections --- block-padding/Cargo.toml | 4 ---- inout/Cargo.toml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/block-padding/Cargo.toml b/block-padding/Cargo.toml index 867f719f..8684e056 100644 --- a/block-padding/Cargo.toml +++ b/block-padding/Cargo.toml @@ -14,7 +14,3 @@ readme = "README.md" [dependencies] hybrid-array = "0.2.0-rc.10" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] diff --git a/inout/Cargo.toml b/inout/Cargo.toml index 45b4c7c5..f2dc2ca1 100644 --- a/inout/Cargo.toml +++ b/inout/Cargo.toml @@ -14,7 +14,3 @@ readme = "README.md" [dependencies] block-padding = { version = "0.4.0-rc.0", path = "../block-padding", optional = true } hybrid-array = "0.2.0-rc.10" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"]