From 54e80a4b6e8954c6d86e068d635055c7eb61a57e Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Fri, 3 Dec 2021 13:15:12 -0700 Subject: [PATCH] elliptic-curve: `non_zero` => `nonzero` In #827, a `ReduceNonZero` trait was added whose method name uses an underscored `*_non_zero`. However, there's already one bit of precedent in the public API: - `SecretKey::to_nonzero_scalar` Since this is already a stable API and providing precedent, for consistency this commit changes all of the unstable/unreleased APIs and internal module naming to use `nonzero` instead of `non_zero`, as this is a non-breaking change. --- elliptic-curve/src/lib.rs | 2 +- elliptic-curve/src/ops.rs | 2 +- elliptic-curve/src/scalar.rs | 2 +- elliptic-curve/src/scalar/{non_zero.rs => nonzero.rs} | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) rename elliptic-curve/src/scalar/{non_zero.rs => nonzero.rs} (97%) diff --git a/elliptic-curve/src/lib.rs b/elliptic-curve/src/lib.rs index 16dab13f3..2da9aeb0f 100644 --- a/elliptic-curve/src/lib.rs +++ b/elliptic-curve/src/lib.rs @@ -98,7 +98,7 @@ pub use { AffineArithmetic, PrimeCurveArithmetic, ProjectiveArithmetic, ScalarArithmetic, }, public_key::PublicKey, - scalar::{non_zero::NonZeroScalar, Scalar}, + scalar::{nonzero::NonZeroScalar, Scalar}, }, ff::{self, Field, PrimeField}, group::{self, Group}, diff --git a/elliptic-curve/src/ops.rs b/elliptic-curve/src/ops.rs index f4449a723..35581647f 100644 --- a/elliptic-curve/src/ops.rs +++ b/elliptic-curve/src/ops.rs @@ -48,5 +48,5 @@ pub trait Reduce: Sized { /// End users can use the `Reduce` impl on `NonZeroScalar` instead. pub trait ReduceNonZero: Sized { /// Perform a modular reduction, returning a field element. - fn from_uint_reduced_non_zero(n: UInt) -> Self; + fn from_uint_reduced_nonzero(n: UInt) -> Self; } diff --git a/elliptic-curve/src/scalar.rs b/elliptic-curve/src/scalar.rs index e8a5be8b1..72d796847 100644 --- a/elliptic-curve/src/scalar.rs +++ b/elliptic-curve/src/scalar.rs @@ -5,7 +5,7 @@ use subtle::Choice; pub(crate) mod core; #[cfg(feature = "arithmetic")] -pub(crate) mod non_zero; +pub(crate) mod nonzero; #[cfg(feature = "arithmetic")] use crate::ScalarArithmetic; diff --git a/elliptic-curve/src/scalar/non_zero.rs b/elliptic-curve/src/scalar/nonzero.rs similarity index 97% rename from elliptic-curve/src/scalar/non_zero.rs rename to elliptic-curve/src/scalar/nonzero.rs index 2692ea08e..eac39aa9b 100644 --- a/elliptic-curve/src/scalar/non_zero.rs +++ b/elliptic-curve/src/scalar/nonzero.rs @@ -207,7 +207,7 @@ where Scalar: ReduceNonZero, { fn from_uint_reduced(n: I) -> Self { - Self::from_uint_reduced_non_zero(n) + Self::from_uint_reduced_nonzero(n) } } @@ -217,8 +217,8 @@ where I: Integer + ArrayEncoding, Scalar: ReduceNonZero, { - fn from_uint_reduced_non_zero(n: I) -> Self { - let scalar = Scalar::::from_uint_reduced_non_zero(n); + fn from_uint_reduced_nonzero(n: I) -> Self { + let scalar = Scalar::::from_uint_reduced_nonzero(n); debug_assert!(!bool::from(scalar.is_zero())); Self::new(scalar).unwrap() }