Fix lint errors in primitives and crypto
What changed, and why it matters
This is a routine code cleanup commit that fixes compiler lint warnings. It removes an unused import, simplifies how a borrowed reference is obtained, makes a large numeric constant more readable with underscores, and adds a missing semicolon. None of these changes affect program behavior or fix any security issue.
No security action required. Treat as normal maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit addresses three categories of lint errors in rust-bitcoin’s crypto and primitives crates: (1) removes an unused core::ops::Deref import in crypto/src/lib.rs; (2) replaces <&PushBytes>::try_from(self.deref()) with the equivalent <&PushBytes>::try_from(&**self) in the Borrow implementation for SerializedLegacyPublicKey; (3) reformats 0x100000000 to 0x1_0000_0000 for readability in push_bytes.rs; and (4) adds a trailing semicolon to PushBytesBuf::reserve. All changes are syntactic or idiomatic and do not alter logic, bounds checking, or runtime behavior.
Changed components
crypto/src/lib.rsprimitives/src/script/push_bytes.rsInspect captured patch +3 / −6
diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs
index 3d7d4cd7..4a473390 100644
--- a/crypto/src/lib.rs
+++ b/crypto/src/lib.rs
@@ -40,7 +40,6 @@ include!("../include/asref_push_bytes.rs");
#[cfg(feature = "alloc")]
mod push_bytes {
use core::borrow::Borrow;
- use core::ops::Deref;
use primitives::script::{PushBytes, PushBytesBuf};
@@ -69,8 +68,6 @@ mod push_bytes {
}
impl Borrow<PushBytes> for SerializedLegacyPublicKey {
- fn borrow(&self) -> &PushBytes {
- <&PushBytes>::try_from(self.deref()).expect("65 <= u32::MAX")
- }
+ fn borrow(&self) -> &PushBytes { <&PushBytes>::try_from(&**self).expect("65 <= u32::MAX") }
}
}
diff --git a/primitives/src/script/push_bytes.rs b/primitives/src/script/push_bytes.rs
index 9227d988..d13f953e 100644
--- a/primitives/src/script/push_bytes.rs
+++ b/primitives/src/script/push_bytes.rs
@@ -28,7 +28,7 @@ mod primitive {
#[cfg(not(any(target_pointer_width = "16", target_pointer_width = "32")))]
fn check_limit(len: usize) -> Result<(), PushBytesError> {
- if len < 0x100000000 {
+ if len < 0x1_0000_0000 {
Ok(())
} else {
Err(PushBytesError { len })
@@ -203,7 +203,7 @@ mod primitive {
/// Reserve capacity for `additional_capacity` bytes.
pub fn reserve(&mut self, additional_capacity: usize) {
- self.0.reserve(additional_capacity)
+ self.0.reserve(additional_capacity);
}
/// Try pushing a single byte.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.