Skip to content

Commit e42f3f8

Browse files
committed
Remove unused error return value
This helper never returns an error, remove the `Result` return type. Found by clippy.
1 parent ed29f12 commit e42f3f8

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/schnorrsig.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<C: Signing> Secp256k1<C> {
384384
msg: &Message,
385385
keypair: &KeyPair,
386386
nonce_data: *const ffi::types::c_void,
387-
) -> Result<Signature, Error> {
387+
) -> Signature {
388388
unsafe {
389389
let mut sig = [0u8; constants::SCHNORRSIG_SIGNATURE_SIZE];
390390
assert_eq!(
@@ -399,15 +399,15 @@ impl<C: Signing> Secp256k1<C> {
399399
)
400400
);
401401

402-
Ok(Signature(sig))
402+
Signature(sig)
403403
}
404404
}
405405

406406
/// Create a schnorr signature internally using the ThreadRng random number
407407
/// generator to generate the auxiliary random data.
408408
/// Requires compilation with "rand-std" feature.
409409
#[cfg(any(test, feature = "rand-std"))]
410-
pub fn schnorrsig_sign(&self, msg: &Message, keypair: &KeyPair) -> Result<Signature, Error> {
410+
pub fn schnorrsig_sign(&self, msg: &Message, keypair: &KeyPair) -> Signature {
411411
let mut rng = thread_rng();
412412
self.schnorrsig_sign_with_rng(msg, keypair, &mut rng)
413413
}
@@ -417,7 +417,7 @@ impl<C: Signing> Secp256k1<C> {
417417
&self,
418418
msg: &Message,
419419
keypair: &KeyPair,
420-
) -> Result<Signature, Error> {
420+
) -> Signature {
421421
self.schnorrsig_sign_helper(msg, keypair, ptr::null())
422422
}
423423

@@ -427,7 +427,7 @@ impl<C: Signing> Secp256k1<C> {
427427
msg: &Message,
428428
keypair: &KeyPair,
429429
aux_rand: &[u8; 32],
430-
) -> Result<Signature, Error> {
430+
) -> Signature {
431431
self.schnorrsig_sign_helper(
432432
msg,
433433
keypair,
@@ -444,7 +444,7 @@ impl<C: Signing> Secp256k1<C> {
444444
msg: &Message,
445445
keypair: &KeyPair,
446446
rng: &mut R,
447-
) -> Result<Signature, Error> {
447+
) -> Signature {
448448
let mut aux = [0u8; 32];
449449
rng.fill_bytes(&mut aux);
450450
self.schnorrsig_sign_helper(msg, keypair, aux.as_c_ptr() as *const ffi::types::c_void)
@@ -533,29 +533,27 @@ mod tests {
533533
let mut aux_rand = [0; 32];
534534
rng.fill_bytes(&mut aux_rand);
535535
secp.schnorrsig_sign_with_aux_rand(msg, seckey, &aux_rand)
536-
.unwrap()
537536
})
538537
}
539538

540539
#[test]
541540
fn test_schnorrsig_sign_with_rng_verify() {
542541
test_schnorrsig_sign_helper(|secp, msg, seckey, mut rng| {
543542
secp.schnorrsig_sign_with_rng(msg, seckey, &mut rng)
544-
.unwrap()
545543
})
546544
}
547545

548546
#[test]
549547
fn test_schnorrsig_sign_verify() {
550548
test_schnorrsig_sign_helper(|secp, msg, seckey, _| {
551-
secp.schnorrsig_sign(msg, seckey).unwrap()
549+
secp.schnorrsig_sign(msg, seckey)
552550
})
553551
}
554552

555553
#[test]
556554
fn test_schnorrsig_sign_no_aux_rand_verify() {
557555
test_schnorrsig_sign_helper(|secp, msg, seckey, _| {
558-
secp.schnorrsig_sign_no_aux_rand(msg, seckey).unwrap()
556+
secp.schnorrsig_sign_no_aux_rand(msg, seckey)
559557
})
560558
}
561559

@@ -575,8 +573,7 @@ mod tests {
575573
let expected_sig = Signature::from_str("6470FD1303DDA4FDA717B9837153C24A6EAB377183FC438F939E0ED2B620E9EE5077C4A8B8DCA28963D772A94F5F0DDF598E1C47C137F91933274C7C3EDADCE8").unwrap();
576574

577575
let sig = secp
578-
.schnorrsig_sign_with_aux_rand(&msg, &sk, &aux_rand)
579-
.unwrap();
576+
.schnorrsig_sign_with_aux_rand(&msg, &sk, &aux_rand);
580577

581578
assert_eq!(expected_sig, sig);
582579
}

0 commit comments

Comments
 (0)