fix: resolve clippy::len_zero lint in Instructions::size_hint
What changed, and why it matters
This is a trivial code-style cleanup. A developer replaced `self.data.len() == 0` with the equivalent but more idiomatic `self.data.as_slice().is_empty()`. The change only silences a Clippy lint and does not alter program behavior or fix any security issue.
No security action needed. Treat as a normal code-quality commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies Instructions::size_hint in bitcoin/src/blockdata/script/instruction.rs. It changes a length comparison to use is_empty() on the slice, satisfying the clippy::len_zero lint. The logic and return values are unchanged; there is no functional or security impact.
Changed components
bitcoin/src/blockdata/script/instruction.rsInspect captured patch +1 / −1
diff --git a/bitcoin/src/blockdata/script/instruction.rs b/bitcoin/src/blockdata/script/instruction.rs
index 05605ac1..3f9fa854 100644
--- a/bitcoin/src/blockdata/script/instruction.rs
+++ b/bitcoin/src/blockdata/script/instruction.rs
@@ -190,7 +190,7 @@ impl<'a> Iterator for Instructions<'a> {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
- if self.data.len() == 0 {
+ if self.data.as_slice().is_empty() {
(0, Some(0))
} else {
// There will not be more instructions than bytes
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.