Skip to content

Commit 6e98ec0

Browse files
committed
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.
1 parent 7fde332 commit 6e98ec0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/context.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ mod alloc_only {
196196
let size = unsafe { ffi::secp256k1_context_preallocated_size(C::FLAGS) };
197197
let layout = alloc::Layout::from_size_align(size, ALIGN_TO).unwrap();
198198
let ptr = unsafe {alloc::alloc(layout)};
199+
200+
#[allow(unused_mut)] // ctx is not mutated under some feature combinations.
199201
let mut ctx = Secp256k1 {
200202
ctx: unsafe { ffi::secp256k1_context_preallocated_create(ptr as *mut c_void, C::FLAGS) },
201203
phantom: PhantomData,
@@ -207,6 +209,7 @@ mod alloc_only {
207209
ctx.randomize(&mut rand::thread_rng());
208210
}
209211

212+
#[allow(clippy::let_and_return)] // as for unusted_mut
210213
ctx
211214
}
212215
}

src/ecdsa/serialized_signature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl PartialEq for SerializedSignature {
4545
impl AsRef<[u8]> for SerializedSignature {
4646
#[inline]
4747
fn as_ref(&self) -> &[u8] {
48-
&*self
48+
self
4949
}
5050
}
5151

0 commit comments

Comments
 (0)