Skip to content

Commit a9fc126

Browse files
committed
Merge rust-bitcoin#4938: fix: resolve clippy::len_zero lint in Instructions::size_hint
b5d4f4f fix: resolve clippy::len_zero lint in Instructions::size_hint (Bugar) Pull request description: Replace `self.data.len() == 0` with `self.data.as_slice().is_empty()` to fix clippy::len_zero warning in the size_hint implementation for Instructions iterator. This addresses the Clippy lint that recommends using is_empty() instead of comparing len() to zero, which is more idiomatic Rust. Uses stable slice.is_empty() via as_slice() to avoid unstable exact_size_is_empty feature. Fixes: clippy::len_zero warning in bitcoin/src/blockdata/script/instruction.rs:193 ACKs for top commit: apoelstra: ACK b5d4f4f; successfully ran local tests Tree-SHA512: bcbdb6573169ce6e742df5d09af2db877d469cd518eb6b445e824e2b7b330a4955311787683c7a5c362b462aec0bdde1f3b3dd0b4593f721e6156c29a18d4e32
2 parents d993692 + b5d4f4f commit a9fc126

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bitcoin/src/blockdata/script/instruction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<'a> Iterator for Instructions<'a> {
190190

191191
#[inline]
192192
fn size_hint(&self) -> (usize, Option<usize>) {
193-
if self.data.len() == 0 {
193+
if self.data.as_slice().is_empty() {
194194
(0, Some(0))
195195
} else {
196196
// There will not be more instructions than bytes

0 commit comments

Comments
 (0)