Merge rust-bitcoin/rust-secp256k1#484: Fix clippy warnings
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: ACK6e98ec0475
Tree-SHA512: 0d0a4d21861f4e0bf27beb4c8f0b46708ca769252582f8133d35013070510dfc997a1e414dd97e8dfcab2afc39fcee61d6fa3c28012b109a81036d6c7d4bfda1
This commit is contained in:
commit
89670c7a31
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ impl PartialEq for SerializedSignature {
|
|||
impl AsRef<[u8]> for SerializedSignature {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &[u8] {
|
||||
&*self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue