From 6c97fb7a6dd3070bb248ca2999a247cdfd5d99f1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 1 Feb 2023 20:37:47 +0100 Subject: [PATCH] Use explicit crate features (#100) (cherry picked from commit 5bce3e3206d571bfeb10594bf384e6f200112757) --- Cargo.toml | 10 +++++----- src/common.rs | 8 ++++---- src/lib.rs | 3 --- src/oprf.rs | 4 ++-- src/poprf.rs | 6 +++--- src/voprf.rs | 4 ++-- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1c6b116..9a23108 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ version = "0.5.0-pre.1" [features] alloc = [] danger = [] -default = ["ristretto255-ciphersuite", "serde"] -ristretto255 = ["curve25519-dalek", "generic-array/more_lengths"] -ristretto255-ciphersuite = ["ristretto255", "sha2"] -serde = ["generic-array/serde", "serde_"] +default = ["ristretto255-ciphersuite", "dep:serde"] +ristretto255 = ["dep:curve25519-dalek", "generic-array/more_lengths"] +ristretto255-ciphersuite = ["ristretto255", "dep:sha2"] +serde = ["generic-array/serde", "dep:serde"] std = ["alloc"] [dependencies] @@ -35,7 +35,7 @@ elliptic-curve = { version = "0.12", features = [ ] } generic-array = "0.14" rand_core = { version = "0.6", default-features = false } -serde_ = { version = "1", package = "serde", default-features = false, features = [ +serde = { version = "1", default-features = false, features = [ "derive", ], optional = true } sha2 = { version = "0.10", default-features = false, optional = true } diff --git a/src/common.rs b/src/common.rs index 02721b8..4c506cf 100644 --- a/src/common.rs +++ b/src/common.rs @@ -72,7 +72,7 @@ impl Mode { #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct BlindedElement( #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -89,7 +89,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct EvaluationElement( #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -106,7 +106,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct PreparedEvaluationElement(pub(crate) EvaluationElement) where @@ -120,7 +120,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct Proof where diff --git a/src/lib.rs b/src/lib.rs index 1dfa360..1d23626 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -555,9 +555,6 @@ extern crate alloc; #[cfg(feature = "std")] extern crate std; -#[cfg(feature = "serde")] -extern crate serde_ as serde; - mod ciphersuite; mod common; mod error; diff --git a/src/oprf.rs b/src/oprf.rs index 6e8d7af..2d0d15c 100644 --- a/src/oprf.rs +++ b/src/oprf.rs @@ -41,7 +41,7 @@ use crate::{CipherSuite, Error, Group, Result}; #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct OprfClient where @@ -59,7 +59,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct OprfServer where diff --git a/src/poprf.rs b/src/poprf.rs index 1dfabe7..eb92aa9 100644 --- a/src/poprf.rs +++ b/src/poprf.rs @@ -41,7 +41,7 @@ use crate::{CipherSuite, Error, Group, Result}; #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct PoprfClient where @@ -61,7 +61,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct PoprfServer where @@ -541,7 +541,7 @@ pub type PoprfServerBatchEvaluatePreparedEvaluationElements = Map< #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct PoprfPreparedTweak( #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] diff --git a/src/voprf.rs b/src/voprf.rs index 4df3b05..82f1463 100644 --- a/src/voprf.rs +++ b/src/voprf.rs @@ -39,7 +39,7 @@ use crate::{CipherSuite, Error, Group, Result}; #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct VoprfClient where @@ -59,7 +59,7 @@ where #[cfg_attr( feature = "serde", derive(serde::Deserialize, serde::Serialize), - serde(crate = "serde", bound = "") + serde(bound = "") )] pub struct VoprfServer where