From b24a112f088f8cb0651f9a27e7195db67f24e305 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 7 Jun 2022 15:09:58 +1000 Subject: [PATCH] Remove calls to clone from types that implement Copy Clippy emits: warning: using `clone` on type `blockdata::transaction::OutPoint` which implements the `Copy` trait Remove calls to `clone` from types that implement `Copy`. --- src/blockdata/block.rs | 2 +- src/util/bip158.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blockdata/block.rs b/src/blockdata/block.rs index 1d9e7a11..c09467f0 100644 --- a/src/blockdata/block.rs +++ b/src/blockdata/block.rs @@ -521,7 +521,7 @@ mod tests { } // test with modified header - let mut invalid_header: BlockHeader = some_header.clone(); + let mut invalid_header: BlockHeader = some_header; invalid_header.version += 1; match invalid_header.validate_pow(&invalid_header.target()) { Err(BlockBadProofOfWork) => (), diff --git a/src/util/bip158.rs b/src/util/bip158.rs index 3b823f00..25f05b70 100644 --- a/src/util/bip158.rs +++ b/src/util/bip158.rs @@ -554,7 +554,7 @@ mod test { let mut si = scripts.iter(); for tx in block.txdata.iter().skip(1) { for input in tx.input.iter() { - txmap.insert(input.previous_output.clone(), Script::from(Vec::from_hex(si.next().unwrap().as_str().unwrap()).unwrap())); + txmap.insert(input.previous_output, Script::from(Vec::from_hex(si.next().unwrap().as_str().unwrap()).unwrap())); } } @@ -562,7 +562,7 @@ mod test { |o| if let Some(s) = txmap.get(o) { Ok(s.clone()) } else { - Err(Error::UtxoMissing(o.clone())) + Err(Error::UtxoMissing(*o)) }).unwrap(); let test_filter = BlockFilter::new(filter_content.as_slice());