Skip to content

Commit c514faa

Browse files
authored
Rename rand feature to rand_core (#1058)
This crate previously had *both* a `rand` and `rand_core` feature, where `rand_core` enabled most functionality, but a small amount was gated under `rand` for no particular reason. This renames those usages to `rand_core`, and the feature overall, which follows the general pattern we use elsewhere.
1 parent f1b5644 commit c514faa

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ proptest = "1.9"
4141
rand_core = "0.10.0-rc-3"
4242

4343
[features]
44-
default = ["rand"]
44+
default = ["rand_core"]
4545
alloc = ["serdect?/alloc"]
4646

4747
extra-sizes = []
48-
getrandom = ["dep:getrandom", "rand"]
49-
rand = ["rand_core"]
48+
getrandom = ["dep:getrandom", "rand_core"]
49+
rand_core = ["dep:rand_core"]
5050
serde = ["dep:serdect"]
5151
subtle = ["dep:subtle", "ctutils/subtle", "hybrid-array?/subtle"]
5252

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
//! using any RNG by using the [`Random`] trait:
118118
//!
119119
//! ```
120-
//! # #[cfg(feature = "rand")]
120+
//! # #[cfg(feature = "rand_core")]
121121
//! # {
122122
//! # use chacha20::ChaCha8Rng;
123123
//! # use rand_core::SeedableRng;
@@ -136,7 +136,7 @@
136136
//! distribution around a given [`NonZero`] modulus.
137137
//!
138138
//! ```
139-
//! # #[cfg(feature = "rand")]
139+
//! # #[cfg(feature = "rand_core")]
140140
//! # {
141141
//! # use chacha20::ChaCha8Rng;
142142
//! # use rand_core::SeedableRng;

src/modular/boxed_monty_form/lincomb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl BoxedMontyForm {
2929
#[cfg(test)]
3030
mod tests {
3131

32-
#[cfg(feature = "rand")]
32+
#[cfg(feature = "rand_core")]
3333
#[test]
3434
fn lincomb_expected() {
3535
use crate::modular::{BoxedMontyForm, BoxedMontyParams};

src/modular/const_monty_form/lincomb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS
2222
#[cfg(test)]
2323
mod tests {
2424

25-
#[cfg(feature = "rand")]
25+
#[cfg(feature = "rand_core")]
2626
#[test]
2727
fn lincomb_expected() {
2828
use super::{ConstMontyForm, ConstMontyParams};

src/modular/monty_form/lincomb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<const LIMBS: usize> MontyForm<LIMBS> {
2828

2929
#[cfg(test)]
3030
mod tests {
31-
#[cfg(feature = "rand")]
31+
#[cfg(feature = "rand_core")]
3232
#[test]
3333
fn lincomb_expected() {
3434
use crate::U256;

src/uint/add_mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<const LIMBS: usize> AddMod for Uint<LIMBS> {
4545
}
4646
}
4747

48-
#[cfg(all(test, feature = "rand"))]
48+
#[cfg(all(test, feature = "rand_core"))]
4949
mod tests {
5050
use crate::{Limb, NonZero, Random, RandomMod, U256, Uint};
5151
use rand_core::SeedableRng;

src/uint/boxed/mul_mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn mac_by_limb(a: &BoxedUint, b: &BoxedUint, c: Limb, carry: Limb) -> (BoxedUint
9090
(a, carry)
9191
}
9292

93-
#[cfg(all(test, feature = "rand"))]
93+
#[cfg(all(test, feature = "rand_core"))]
9494
mod tests {
9595
use crate::{Limb, NonZero, Random, RandomMod, Uint};
9696
use rand_core::SeedableRng;

src/uint/boxed/sqrt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl SquareRoot for BoxedUint {
133133
mod tests {
134134
use crate::{BoxedUint, Limb};
135135

136-
#[cfg(feature = "rand")]
136+
#[cfg(feature = "rand_core")]
137137
use {
138138
crate::RandomBits,
139139
chacha20::ChaCha8Rng,
@@ -284,7 +284,7 @@ mod tests {
284284
assert_eq!(BoxedUint::from(10u8).sqrt_vartime(), BoxedUint::from(3u8));
285285
}
286286

287-
#[cfg(feature = "rand")]
287+
#[cfg(feature = "rand_core")]
288288
#[test]
289289
fn fuzz() {
290290
let mut rng = ChaCha8Rng::from_seed([7u8; 32]);

src/uint/div.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ mod tests {
678678
Uint, Word, Zero,
679679
};
680680

681-
#[cfg(feature = "rand")]
681+
#[cfg(feature = "rand_core")]
682682
use {crate::Random, chacha20::ChaCha8Rng, rand_core::RngCore, rand_core::SeedableRng};
683683

684684
#[test]
@@ -706,7 +706,7 @@ mod tests {
706706
}
707707
}
708708

709-
#[cfg(feature = "rand")]
709+
#[cfg(feature = "rand_core")]
710710
#[test]
711711
fn div() {
712712
let mut rng = ChaCha8Rng::from_seed([7u8; 32]);
@@ -914,7 +914,7 @@ mod tests {
914914
assert_eq!(r, a);
915915
}
916916

917-
#[cfg(feature = "rand")]
917+
#[cfg(feature = "rand_core")]
918918
#[test]
919919
fn rem2krand() {
920920
let mut rng = ChaCha8Rng::from_seed([7u8; 32]);

src/uint/encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ mod tests {
11301130
assert_eq!(&out, hex);
11311131
}
11321132

1133-
#[cfg(all(feature = "rand", feature = "alloc"))]
1133+
#[cfg(all(feature = "rand_core", feature = "alloc"))]
11341134
#[test]
11351135
fn encode_radix_round_trip() {
11361136
use crate::{Random, U256};

0 commit comments

Comments
 (0)