Remove redundant clone

Clippy emits:

  warning: redundant clone

Remove the redundant calls to clone.
This commit is contained in:
Tobin C. Harding 2022-06-07 15:01:40 +10:00
parent cf8de73169
commit a8039e1742
3 changed files with 3 additions and 3 deletions

View File

@ -1092,7 +1092,7 @@ mod tests {
let expected_strippedsize = (EXPECTED_WEIGHT - tx_bytes.len()) / (WITNESS_SCALE_FACTOR - 1); let expected_strippedsize = (EXPECTED_WEIGHT - tx_bytes.len()) / (WITNESS_SCALE_FACTOR - 1);
assert_eq!(realtx.strippedsize(), expected_strippedsize); assert_eq!(realtx.strippedsize(), expected_strippedsize);
// Construct a transaction without the witness data. // Construct a transaction without the witness data.
let mut tx_without_witness = realtx.clone(); let mut tx_without_witness = realtx;
tx_without_witness.input.iter_mut().for_each(|input| input.witness.clear()); tx_without_witness.input.iter_mut().for_each(|input| input.witness.clear());
assert_eq!(tx_without_witness.weight(), expected_strippedsize*WITNESS_SCALE_FACTOR); assert_eq!(tx_without_witness.weight(), expected_strippedsize*WITNESS_SCALE_FACTOR);
assert_eq!(tx_without_witness.size(), expected_strippedsize); assert_eq!(tx_without_witness.size(), expected_strippedsize);

View File

@ -651,7 +651,7 @@ mod test {
query.push(p.clone()); query.push(p.clone());
} }
query.push(Vec::from_hex("abcdef").unwrap()); query.push(Vec::from_hex("abcdef").unwrap());
let mut input = Cursor::new(bytes.clone()); let mut input = Cursor::new(bytes);
assert!(!reader.match_all(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap()); assert!(!reader.match_all(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap());
} }
} }

View File

@ -393,7 +393,7 @@ mod tests {
let mut builder = compose_taproot_builder(0x51, &[2, 2, 2]); let mut builder = compose_taproot_builder(0x51, &[2, 2, 2]);
builder = builder.add_leaf_with_ver(3, Script::from_hex("b9").unwrap(), LeafVersion::from_consensus(0xC2).unwrap()).unwrap(); builder = builder.add_leaf_with_ver(3, Script::from_hex("b9").unwrap(), LeafVersion::from_consensus(0xC2).unwrap()).unwrap();
builder = builder.add_hidden_node(3, sha256::Hash::default()).unwrap(); builder = builder.add_hidden_node(3, sha256::Hash::default()).unwrap();
assert!(TapTree::from_builder(builder.clone()).is_err()); assert!(TapTree::from_builder(builder).is_err());
} }
#[test] #[test]