@@ -27,10 +27,11 @@ pub mod global {
2727
2828 /// A global static context to avoid repeatedly creating contexts.
2929 ///
30- /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
30+ /// If `rand` and `std` feature is enabled, context will have been randomized using
31+ /// `thread_rng`.
3132 ///
3233 /// ```
33- /// # #[cfg(all(feature = "global-context", feature = "rand- std"))] {
34+ /// # #[cfg(all(feature = "global-context", feature = "rand", feature = " std"))] {
3435 /// use secp256k1::{PublicKey, SECP256K1};
3536 /// let _ = SECP256K1.generate_keypair(&mut rand::thread_rng());
3637 /// # }
@@ -40,15 +41,16 @@ pub mod global {
4041 impl Deref for GlobalContext {
4142 type Target = Secp256k1 < All > ;
4243
43- #[ allow( unused_mut) ] // Unused when `rand- std` is not enabled.
44+ #[ allow( unused_mut) ] // Unused when `rand` + ` std` is not enabled.
4445 fn deref ( & self ) -> & Self :: Target {
4546 static ONCE : Once = Once :: new ( ) ;
4647 static mut CONTEXT : Option < Secp256k1 < All > > = None ;
4748 ONCE . call_once ( || unsafe {
4849 let mut ctx = Secp256k1 :: new ( ) ;
4950 #[ cfg( all(
5051 not( target_arch = "wasm32" ) ,
51- feature = "rand-std" ,
52+ feature = "rand" ,
53+ feature = "std" ,
5254 not( feature = "global-context-less-secure" )
5355 ) ) ]
5456 {
@@ -181,10 +183,12 @@ mod alloc_only {
181183 impl < C : Context > Secp256k1 < C > {
182184 /// Lets you create a context in a generic manner (sign/verify/all).
183185 ///
184- /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
185- /// If `rand-std` feature is not enabled please consider randomizing the context as follows:
186+ /// If `rand` and `std` feature is enabled, context will have been randomized using
187+ /// `thread_rng`.
188+ /// If `rand` or `std` feature is not enabled please consider randomizing the context as
189+ /// follows:
186190 /// ```
187- /// # #[cfg(feature = "rand- std")] {
191+ /// # #[cfg(all( feature = "rand", feature = " std") )] {
188192 /// # use secp256k1::Secp256k1;
189193 /// # use secp256k1::rand::{thread_rng, RngCore};
190194 /// let mut ctx = Secp256k1::new();
@@ -195,7 +199,10 @@ mod alloc_only {
195199 /// ctx.seeded_randomize(&seed);
196200 /// # }
197201 /// ```
198- #[ cfg_attr( not( feature = "rand-std" ) , allow( clippy:: let_and_return, unused_mut) ) ]
202+ #[ cfg_attr(
203+ not( all( feature = "rand" , feature = "std" ) ) ,
204+ allow( clippy:: let_and_return, unused_mut)
205+ ) ]
199206 pub fn gen_new ( ) -> Secp256k1 < C > {
200207 #[ cfg( target_arch = "wasm32" ) ]
201208 ffi:: types:: sanity_checks_for_wasm ( ) ;
@@ -214,7 +221,8 @@ mod alloc_only {
214221
215222 #[ cfg( all(
216223 not( target_arch = "wasm32" ) ,
217- feature = "rand-std" ,
224+ feature = "rand" ,
225+ feature = "std" ,
218226 not( feature = "global-context-less-secure" )
219227 ) ) ]
220228 {
@@ -229,27 +237,30 @@ mod alloc_only {
229237 impl Secp256k1 < All > {
230238 /// Creates a new Secp256k1 context with all capabilities.
231239 ///
232- /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
233- /// If `rand-std` feature is not enabled please consider randomizing the context (see docs
234- /// for `Secp256k1::gen_new()`).
240+ /// If `rand` and `std` feature is enabled, context will have been randomized using
241+ /// `thread_rng`.
242+ /// If `rand` or `std` feature is not enabled please consider randomizing the context (see
243+ /// docs for `Secp256k1::gen_new()`).
235244 pub fn new ( ) -> Secp256k1 < All > { Secp256k1 :: gen_new ( ) }
236245 }
237246
238247 impl Secp256k1 < SignOnly > {
239248 /// Creates a new Secp256k1 context that can only be used for signing.
240249 ///
241- /// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
242- /// If `rand-std` feature is not enabled please consider randomizing the context (see docs
243- /// for `Secp256k1::gen_new()`).
250+ /// If `rand` and `std` feature is enabled, context will have been randomized using
251+ /// `thread_rng`.
252+ /// If `rand` or `std` feature is not enabled please consider randomizing the context (see
253+ /// docs for `Secp256k1::gen_new()`).
244254 pub fn signing_only ( ) -> Secp256k1 < SignOnly > { Secp256k1 :: gen_new ( ) }
245255 }
246256
247257 impl Secp256k1 < VerifyOnly > {
248258 /// Creates a new Secp256k1 context that can only be used for verification.
249259 ///
250- /// * If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
251- /// * If `rand-std` feature is not enabled please consider randomizing the context (see docs
252- /// for `Secp256k1::gen_new()`).
260+ /// If `rand` and `std` feature is enabled, context will have been randomized using
261+ /// `thread_rng`.
262+ /// If `rand` or `std` feature is not enabled please consider randomizing the context (see
263+ /// docs for `Secp256k1::gen_new()`).
253264 pub fn verification_only ( ) -> Secp256k1 < VerifyOnly > { Secp256k1 :: gen_new ( ) }
254265 }
255266
0 commit comments