Skip to content
4 changes: 2 additions & 2 deletions examples/generate_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ fn main() {
// First option:
let (seckey, pubkey) = secp.generate_keypair(&mut rng);

assert_eq!(pubkey, PublicKey::from_secret_key(&secp, &seckey));
assert_eq!(pubkey, PublicKey::from_secret_key(&seckey));

// Second option:
let seckey = SecretKey::new(&mut rng);
let _pubkey = PublicKey::from_secret_key(&secp, &seckey);
let _pubkey = PublicKey::from_secret_key(&seckey);
}
2 changes: 1 addition & 1 deletion examples/musig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn main() {
let (seckey1, pubkey1) = secp.generate_keypair(&mut rng);

let seckey2 = SecretKey::new(&mut rng);
let pubkey2 = PublicKey::from_secret_key(&secp, &seckey2);
let pubkey2 = PublicKey::from_secret_key(&seckey2);

let pubkeys = [pubkey1, pubkey2];
let mut pubkeys_ref: Vec<&PublicKey> = pubkeys.iter().collect();
Expand Down
4 changes: 2 additions & 2 deletions no_std_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
let mut secp = Secp256k1::preallocated_new(&mut buf).unwrap();
secp.randomize(&mut FakeRng);
let secret_key = SecretKey::new(&mut FakeRng);
let public_key = PublicKey::from_secret_key(&secp, &secret_key);
let public_key = PublicKey::from_secret_key(&secret_key);
let message = Message::from_digest_slice(&[0xab; 32]).expect("32 bytes");

let sig = secp.sign_ecdsa(message, &secret_key);
Expand All @@ -106,7 +106,7 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
#[cfg(feature = "alloc")]
{
let secp_alloc = Secp256k1::new();
let public_key = PublicKey::from_secret_key(&secp_alloc, &secret_key);
let public_key = PublicKey::from_secret_key(&secret_key);
let message = Message::from_digest_slice(&[0xab; 32]).expect("32 bytes");

let sig = secp_alloc.sign_ecdsa(message, &secret_key);
Expand Down
2 changes: 1 addition & 1 deletion src/ecdsa/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ mod tests {
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;

use super::{RecoverableSignature, RecoveryId};
use super::*;
use crate::constants::ONE;
use crate::{Error, Message, Secp256k1, SecretKey};

Expand Down
2 changes: 1 addition & 1 deletion src/ecdsa/serialized_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ mod into_iter {

#[cfg(test)]
mod tests {
use super::{SerializedSignature, MAX_LEN};
use super::*;

#[test]
fn iterator_ops_are_homomorphic() {
Expand Down
11 changes: 4 additions & 7 deletions src/ellswift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ impl ElligatorSwift {
/// # Example
/// ```
/// # #[cfg(feature = "alloc")] {
/// use secp256k1::{ellswift::ElligatorSwift, PublicKey, Secp256k1, SecretKey};
/// let secp = Secp256k1::new();
/// use secp256k1::{ellswift::ElligatorSwift, PublicKey, SecretKey};
/// let sk = SecretKey::from_secret_bytes([1; 32]).unwrap();
/// let pk = PublicKey::from_secret_key(&secp, &sk);
/// let pk = PublicKey::from_secret_key(&sk);
/// let es = ElligatorSwift::from_pubkey(pk);
/// # }
///
Expand Down Expand Up @@ -375,9 +374,8 @@ mod tests {
#[cfg(all(not(secp256k1_fuzz), feature = "alloc"))]
fn test_elligator_swift_rtt() {
// Test that we can round trip an ElligatorSwift encoding
let secp = crate::Secp256k1::new();
let public_key =
PublicKey::from_secret_key(&secp, &SecretKey::from_secret_bytes([1u8; 32]).unwrap());
PublicKey::from_secret_key(&SecretKey::from_secret_bytes([1u8; 32]).unwrap());

let ell = ElligatorSwift::from_pubkey(public_key);
let pk = PublicKey::from_ellswift(ell);
Expand All @@ -393,8 +391,7 @@ mod tests {
let ell =
ElligatorSwift::from_seckey(&secp, SecretKey::from_secret_bytes(rand32).unwrap(), None);
let pk = PublicKey::from_ellswift(ell);
let expected =
PublicKey::from_secret_key(&secp, &SecretKey::from_secret_bytes(priv32).unwrap());
let expected = PublicKey::from_secret_key(&SecretKey::from_secret_bytes(priv32).unwrap());

assert_eq!(pk, expected);
}
Expand Down
Loading