diff --git a/src/crl.rs b/src/crl.rs index 976d34e2..816e67df 100644 --- a/src/crl.rs +++ b/src/crl.rs @@ -57,7 +57,6 @@ pub trait CertRevocationList: Sealed + Debug { /// /// [^1]: #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] #[derive(Debug, Clone)] pub struct OwnedCertRevocationList { /// A map of the revoked certificates contained in then CRL, keyed by the DER encoding @@ -144,7 +143,6 @@ impl<'a> BorrowedCertRevocationList<'a> { /// Convert the CRL to an [`OwnedCertRevocationList`]. This may error if any of the revoked /// certificates in the CRL are malformed or contain unsupported features. #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn to_owned(&self) -> Result { // Parse and collect the CRL's revoked cert entries, ensuring there are no errors. With // the full set in-hand, create a lookup map by serial number for fast revocation checking. @@ -452,7 +450,6 @@ pub struct BorrowedRevokedCert<'a> { impl<'a> BorrowedRevokedCert<'a> { /// Construct an owned representation of the revoked certificate. #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn to_owned(&self) -> OwnedRevokedCert { OwnedRevokedCert { serial_number: self.serial_number.to_vec(), diff --git a/src/end_entity.rs b/src/end_entity.rs index 7fdb1200..81536f3f 100644 --- a/src/end_entity.rs +++ b/src/end_entity.rs @@ -159,7 +159,6 @@ impl<'a> EndEntityCert<'a> { /// Verification functions are already provided as `verify_is_valid_for_dns_name` /// and `verify_is_valid_for_at_least_one_dns_name`. #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn dns_names(&'a self) -> Result>, Error> { subject_name::list_cert_dns_names(self) } diff --git a/src/error.rs b/src/error.rs index 62b52ca3..40649b57 100644 --- a/src/error.rs +++ b/src/error.rs @@ -248,7 +248,6 @@ impl fmt::Display for Error { } #[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl ::std::error::Error for Error {} impl From for Error { diff --git a/src/lib.rs b/src/lib.rs index 3e86d7bf..e245b32c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ clippy::upper_case_acronyms )] // Enable documentation for all features on docs.rs -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #[cfg(any(test, feature = "alloc"))] #[cfg_attr(test, macro_use)] @@ -78,20 +78,17 @@ pub use { }, }; -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] #[cfg(feature = "alloc")] pub use { crl::{OwnedCertRevocationList, OwnedRevokedCert}, subject_name::{DnsName, IpAddr}, }; -#[cfg_attr(docsrs, doc(cfg(feature = "ring")))] #[cfg(feature = "ring")] pub use ring_algs::{ ECDSA_P256_SHA256, ECDSA_P256_SHA384, ECDSA_P384_SHA256, ECDSA_P384_SHA384, ED25519, }; -#[cfg_attr(docsrs, doc(cfg(all(feature = "ring", feature = "alloc"))))] #[cfg(all(feature = "ring", feature = "alloc"))] pub use ring_algs::{ RSA_PKCS1_2048_8192_SHA256, RSA_PKCS1_2048_8192_SHA384, RSA_PKCS1_2048_8192_SHA512, diff --git a/src/ring_algs.rs b/src/ring_algs.rs index 053c9238..5e861863 100644 --- a/src/ring_algs.rs +++ b/src/ring_algs.rs @@ -72,8 +72,6 @@ pub static ECDSA_P384_SHA384: &dyn SignatureVerificationAlgorithm = &RingAlgorit }; /// RSA PKCS#1 1.5 signatures using SHA-256 for keys of 2048-8192 bits. -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PKCS1_2048_8192_SHA256: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { public_key_alg_id: alg_id::RSA_ENCRYPTION, @@ -82,8 +80,6 @@ pub static RSA_PKCS1_2048_8192_SHA256: &dyn SignatureVerificationAlgorithm = &Ri }; /// RSA PKCS#1 1.5 signatures using SHA-384 for keys of 2048-8192 bits. -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PKCS1_2048_8192_SHA384: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { public_key_alg_id: alg_id::RSA_ENCRYPTION, @@ -92,8 +88,6 @@ pub static RSA_PKCS1_2048_8192_SHA384: &dyn SignatureVerificationAlgorithm = &Ri }; /// RSA PKCS#1 1.5 signatures using SHA-512 for keys of 2048-8192 bits. -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PKCS1_2048_8192_SHA512: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { public_key_alg_id: alg_id::RSA_ENCRYPTION, @@ -102,8 +96,6 @@ pub static RSA_PKCS1_2048_8192_SHA512: &dyn SignatureVerificationAlgorithm = &Ri }; /// RSA PKCS#1 1.5 signatures using SHA-384 for keys of 3072-8192 bits. -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PKCS1_3072_8192_SHA384: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { public_key_alg_id: alg_id::RSA_ENCRYPTION, @@ -115,8 +107,6 @@ pub static RSA_PKCS1_3072_8192_SHA384: &dyn SignatureVerificationAlgorithm = &Ri /// type rsaEncryption; see [RFC 4055 Section 1.2]. /// /// [RFC 4055 Section 1.2]: https://tools.ietf.org/html/rfc4055#section-1.2 -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PSS_2048_8192_SHA256_LEGACY_KEY: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { @@ -129,8 +119,6 @@ pub static RSA_PSS_2048_8192_SHA256_LEGACY_KEY: &dyn SignatureVerificationAlgori /// type rsaEncryption; see [RFC 4055 Section 1.2]. /// /// [RFC 4055 Section 1.2]: https://tools.ietf.org/html/rfc4055#section-1.2 -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PSS_2048_8192_SHA384_LEGACY_KEY: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { @@ -143,8 +131,6 @@ pub static RSA_PSS_2048_8192_SHA384_LEGACY_KEY: &dyn SignatureVerificationAlgori /// type rsaEncryption; see [RFC 4055 Section 1.2]. /// /// [RFC 4055 Section 1.2]: https://tools.ietf.org/html/rfc4055#section-1.2 -/// -/// Requires the `alloc` feature. #[cfg(feature = "alloc")] pub static RSA_PSS_2048_8192_SHA512_LEGACY_KEY: &dyn SignatureVerificationAlgorithm = &RingAlgorithm { diff --git a/src/signed_data.rs b/src/signed_data.rs index f77b081f..a4143fda 100644 --- a/src/signed_data.rs +++ b/src/signed_data.rs @@ -21,7 +21,6 @@ use alloc::vec::Vec; /// X.509 certificates and related items that are signed are almost always /// encoded in the format "tbs||signatureAlgorithm||signature". This structure /// captures this pattern as an owned data type. -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] #[cfg(feature = "alloc")] #[derive(Clone, Debug)] pub(crate) struct OwnedSignedData { @@ -132,7 +131,6 @@ impl<'a> SignedData<'a> { /// Convert the borrowed signed data to an [`OwnedSignedData`]. #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub(crate) fn to_owned(&self) -> OwnedSignedData { OwnedSignedData { data: self.data.as_slice_less_safe().to_vec(), diff --git a/src/subject_name/dns_name.rs b/src/subject_name/dns_name.rs index 71bf675d..bacdeed1 100644 --- a/src/subject_name/dns_name.rs +++ b/src/subject_name/dns_name.rs @@ -33,12 +33,10 @@ use crate::Error; /// /// Requires the `alloc` feature. #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct DnsName(String); #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] impl DnsName { /// Returns a `DnsNameRef` that refers to this `DnsName`. pub fn as_ref(&self) -> DnsNameRef { @@ -47,7 +45,6 @@ impl DnsName { } #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] impl AsRef for DnsName { fn as_ref(&self) -> &str { self.0.as_ref() @@ -87,7 +84,6 @@ impl core::fmt::Display for InvalidDnsNameError { } #[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl ::std::error::Error for InvalidDnsNameError {} impl<'a> DnsNameRef<'a> { @@ -113,7 +109,6 @@ impl<'a> DnsNameRef<'a> { /// Constructs a `DnsName` from this `DnsNameRef` #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn to_owned(&self) -> DnsName { // DnsNameRef is already guaranteed to be valid ASCII, which is a // subset of UTF-8. diff --git a/src/subject_name/ip_address.rs b/src/subject_name/ip_address.rs index d3f5465f..e8f1ac22 100644 --- a/src/subject_name/ip_address.rs +++ b/src/subject_name/ip_address.rs @@ -24,7 +24,6 @@ const VALID_IP_BY_CONSTRUCTION: &str = "IP address is a valid string by construc /// Either a IPv4 or IPv6 address, plus its owned string representation #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub enum IpAddr { /// An IPv4 address and its owned string representation @@ -34,7 +33,6 @@ pub enum IpAddr { } #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] impl AsRef for IpAddr { fn as_ref(&self) -> &str { match self { @@ -53,7 +51,6 @@ pub enum IpAddrRef<'a> { } #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] impl<'a> From> for IpAddr { fn from(ip_address: IpAddrRef<'a>) -> IpAddr { match ip_address { @@ -70,7 +67,6 @@ impl<'a> From> for IpAddr { } #[cfg(feature = "alloc")] -#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] impl<'a> From<&'a IpAddr> for IpAddrRef<'a> { fn from(ip_address: &'a IpAddr) -> IpAddrRef<'a> { match ip_address { @@ -96,7 +92,6 @@ impl core::fmt::Display for AddrParseError { } #[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl ::std::error::Error for AddrParseError {} impl<'a> IpAddrRef<'a> { @@ -120,7 +115,6 @@ impl<'a> IpAddrRef<'a> { /// Constructs an `IpAddr` from this `IpAddrRef` #[cfg(feature = "alloc")] - #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn to_owned(&self) -> IpAddr { match self { IpAddrRef::V4(ip_address, ip_address_octets) => IpAddr::V4( @@ -155,7 +149,6 @@ fn ipv6_to_uncompressed_string(octets: [u8; 16]) -> String { } #[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl From for IpAddr { fn from(ip_address: std::net::IpAddr) -> IpAddr { match ip_address { diff --git a/src/time.rs b/src/time.rs index 54350657..65153f26 100644 --- a/src/time.rs +++ b/src/time.rs @@ -107,7 +107,6 @@ impl<'a> FromDer<'a> for Time { } #[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl TryFrom for Time { type Error = std::time::SystemTimeError;