Fix clippy warnings
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.
This commit is contained in:
parent
7fde332507
commit
6e98ec0475
|
@ -196,6 +196,8 @@ mod alloc_only {
|
||||||
let size = unsafe { ffi::secp256k1_context_preallocated_size(C::FLAGS) };
|
let size = unsafe { ffi::secp256k1_context_preallocated_size(C::FLAGS) };
|
||||||
let layout = alloc::Layout::from_size_align(size, ALIGN_TO).unwrap();
|
let layout = alloc::Layout::from_size_align(size, ALIGN_TO).unwrap();
|
||||||
let ptr = unsafe {alloc::alloc(layout)};
|
let ptr = unsafe {alloc::alloc(layout)};
|
||||||
|
|
||||||
|
#[allow(unused_mut)] // ctx is not mutated under some feature combinations.
|
||||||
let mut ctx = Secp256k1 {
|
let mut ctx = Secp256k1 {
|
||||||
ctx: unsafe { ffi::secp256k1_context_preallocated_create(ptr as *mut c_void, C::FLAGS) },
|
ctx: unsafe { ffi::secp256k1_context_preallocated_create(ptr as *mut c_void, C::FLAGS) },
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
@ -207,6 +209,7 @@ mod alloc_only {
|
||||||
ctx.randomize(&mut rand::thread_rng());
|
ctx.randomize(&mut rand::thread_rng());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::let_and_return)] // as for unusted_mut
|
||||||
ctx
|
ctx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl PartialEq for SerializedSignature {
|
||||||
impl AsRef<[u8]> for SerializedSignature {
|
impl AsRef<[u8]> for SerializedSignature {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
&*self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue