Cleanup: enabled doc_auto_cfg and doc_cfg_hide

This commit is contained in:
Michael Rosenberg 2022-11-26 06:34:48 -05:00
parent 289cc52fef
commit 791ba170b1
7 changed files with 3 additions and 62 deletions

View file

@ -9,7 +9,7 @@
// - isis agora lovecruft <isis@patternsinthevoid.net>
// - Henry de Valence <hdevalence@hdevalence.ca>
//! INTERNALS: Pluggable implementations for different architectures.
//! **INTERNALS:** Pluggable implementations for different architectures.
//!
//! The backend code is split into two parts: a serial backend,
//! and a vector backend.
@ -37,5 +37,4 @@
pub mod serial;
#[cfg(any(feature = "simd_backend", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "simd_backend")))]
pub mod vector;

View file

@ -23,25 +23,15 @@ use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "fiat_backend")] {
#[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub mod fiat_u32;
#[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub mod fiat_u64;
} else {
#[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub mod u32;
#[cfg(target_pointer_width = "64")]
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub mod u64;
}
}
@ -52,11 +42,4 @@ pub mod curve_models;
feature = "simd_backend",
any(target_feature = "avx2", target_feature = "avx512ifma")
)))]
#[cfg_attr(
docsrs,
doc(cfg(not(all(
feature = "simd_backend",
any(target_feature = "avx2", target_feature = "avx512ifma")
))))
)]
pub mod scalar_mul;

View file

@ -18,36 +18,22 @@ compile_error!("simd_backend selected without target_feature=+avx2 or +avx512ifm
all(target_feature = "avx2", not(target_feature = "avx512ifma")),
docsrs
))]
#[cfg_attr(
docsrs,
doc(cfg(all(target_feature = "avx2", not(target_feature = "avx512ifma")),))
)]
pub mod avx2;
#[cfg(any(
all(target_feature = "avx2", not(target_feature = "avx512ifma")),
docsrs
))]
#[cfg_attr(
docsrs,
doc(cfg(all(target_feature = "avx2", not(target_feature = "avx512ifma")),))
)]
pub(crate) use self::avx2::{
constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint,
};
#[cfg(any(target_feature = "avx512ifma", docsrs))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "avx512ifma")))]
pub mod ifma;
#[cfg(target_feature = "avx512ifma")]
#[cfg_attr(docsrs, doc(cfg(target_feature = "avx512ifma")))]
pub(crate) use self::ifma::{
constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint,
};
#[cfg(any(target_feature = "avx2", target_feature = "avx512ifma", docsrs))]
#[cfg_attr(
docsrs,
doc(cfg(any(target_feature = "avx2", target_feature = "avx512ifma")))
)]
#[allow(missing_docs)]
pub mod scalar_mul;

View file

@ -223,7 +223,6 @@ use serde::de::Visitor;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for EdwardsPoint {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@ -239,7 +238,6 @@ impl Serialize for EdwardsPoint {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for CompressedEdwardsY {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@ -255,7 +253,6 @@ impl Serialize for CompressedEdwardsY {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for EdwardsPoint {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
@ -291,7 +288,6 @@ impl<'de> Deserialize<'de> for EdwardsPoint {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for CompressedEdwardsY {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where

View file

@ -38,16 +38,8 @@ use crate::constants;
cfg_if! {
if #[cfg(feature = "fiat_backend")] {
#[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub use backend::serial::fiat_u32::field::*;
#[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub use backend::serial::fiat_u64::field::*;
/// A `FieldElement` represents an element of the field
@ -58,10 +50,6 @@ cfg_if! {
///
/// Using formally-verified field arithmetic from fiat-crypto.
#[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub type FieldElement = backend::serial::fiat_u32::field::FieldElement2625;
/// A `FieldElement` represents an element of the field
@ -72,13 +60,8 @@ cfg_if! {
///
/// Using formally-verified field arithmetic from fiat-crypto.
#[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub type FieldElement = backend::serial::fiat_u64::field::FieldElement51;
} else if #[cfg(target_pointer_width = "64")] {
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub use crate::backend::serial::u64::field::*;
/// A `FieldElement` represents an element of the field
@ -86,10 +69,8 @@ cfg_if! {
///
/// The `FieldElement` type is an alias for one of the platform-specific
/// implementations.
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub type FieldElement = backend::serial::u64::field::FieldElement51;
} else {
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub use backend::serial::u32::field::*;
/// A `FieldElement` represents an element of the field
@ -97,7 +78,6 @@ cfg_if! {
///
/// The `FieldElement` type is an alias for one of the platform-specific
/// implementations.
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub type FieldElement = backend::serial::u32::field::FieldElement2625;
}
}

View file

@ -10,8 +10,9 @@
// - Henry de Valence <hdevalence@hdevalence.ca>
#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(feature = "simd_backend", feature(stdsimd))]
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
#![cfg_attr(docsrs, doc(cfg_hide(docsrs)))]
//------------------------------------------------------------------------
// Documentation:
//------------------------------------------------------------------------

View file

@ -341,7 +341,6 @@ use serde::de::Visitor;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for RistrettoPoint {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@ -357,7 +356,6 @@ impl Serialize for RistrettoPoint {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for CompressedRistretto {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@ -373,7 +371,6 @@ impl Serialize for CompressedRistretto {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for RistrettoPoint {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
@ -409,7 +406,6 @@ impl<'de> Deserialize<'de> for RistrettoPoint {
}
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for CompressedRistretto {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where