Skip to content

Commit e2d47a2

Browse files
committed
Remove unnecessary import statement
The global context is already in scope in tests since we use a glob import. No clue why Clippy does not warn for this. Remove unnecessary import statement in test function.
1 parent d79989b commit e2d47a2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/lib.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@
5757
//! # }
5858
//! ```
5959
//!
60+
//! If the "global-context" feature is enabled you have access to an alternate API.
61+
//!
62+
//! ```rust
63+
//! # #[cfg(all(feature="global-context", feature = "std", feature="rand-std", features = "bitcoin_hashes"))] {
64+
//! use secp256k1::rand::thread_rng;
65+
//! use secp256k1::{generate_keypair, Message};
66+
//! use secp256k1::hashes::sha256;
67+
//!
68+
//! let (secret_key, public_key) = generate_keypair(&mut thread_rng());
69+
//! let message = Message::from_hashed_data::<sha256::Hash>("Hello World!".as_bytes());
70+
//!
71+
//! let sig = secret_key.sign_ecdsa(&message, &secret_key);
72+
//! assert!(sig.verify(&message, &public_key).is_ok());
73+
//! # }
74+
//! ```
75+
//!
6076
//! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `bitcoin_hashes`
6177
//! feature enabled, to get access to [`generate_keypair`](struct.Secp256k1.html#method.generate_keypair)
6278
//! Alternately, keys and messages can be parsed from slices, like
@@ -968,8 +984,6 @@ mod tests {
968984
#[cfg(feature = "global-context")]
969985
#[test]
970986
fn test_global_context() {
971-
use super::SECP256K1;
972-
973987
let sk_data = hex!("e6dd32f8761625f105c39a39f19370b3521d845a12456d60ce44debd0a362641");
974988
let sk = SecretKey::from_slice(&sk_data).unwrap();
975989
let msg_data = hex!("a4965ca63b7d8562736ceec36dfa5a11bf426eb65be8ea3f7a49ae363032da0d");

0 commit comments

Comments
 (0)