6e98ec0475 Fix clippy warnings (Tobin C. Harding)

Pull request description:

  Clippy default settings seemed to have changed introducing a few new warnings.

  warning: variable does not need to be mutable
  warning: deref on an immutable reference
  warning: returning the result of a `let` binding from a block

  Fix them all in a single patch because CI has to pass for each patch.

  cc apoelstra, turns out you were right I was wrong, clippy did change, cannot remember which PR we were discussing it on.

ACKs for top commit:
  apoelstra:
    ACK 6e98ec0475

Tree-SHA512: 0d0a4d21861f4e0bf27beb4c8f0b46708ca769252582f8133d35013070510dfc997a1e414dd97e8dfcab2afc39fcee61d6fa3c28012b109a81036d6c7d4bfda1
This commit is contained in:
Andrew Poelstra 2022-08-12 16:00:14 +00:00
commit 89670c7a31
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 4 additions and 1 deletions

View File

@ -196,6 +196,8 @@ mod alloc_only {
let size = unsafe { ffi::secp256k1_context_preallocated_size(C::FLAGS) };
let layout = alloc::Layout::from_size_align(size, ALIGN_TO).unwrap();
let ptr = unsafe {alloc::alloc(layout)};
#[allow(unused_mut)] // ctx is not mutated under some feature combinations.
let mut ctx = Secp256k1 {
ctx: unsafe { ffi::secp256k1_context_preallocated_create(ptr as *mut c_void, C::FLAGS) },
phantom: PhantomData,
@ -207,6 +209,7 @@ mod alloc_only {
ctx.randomize(&mut rand::thread_rng());
}
#[allow(clippy::let_and_return)] // as for unusted_mut
ctx
}
}

View File

@ -45,7 +45,7 @@ impl PartialEq for SerializedSignature {
impl AsRef<[u8]> for SerializedSignature {
#[inline]
fn as_ref(&self) -> &[u8] {
&*self
self
}
}