Merge rust-bitcoin/rust-bitcoin#1299: Fix clippy warnings
f5412e2aa2
Fix clippy warnings (Tobin C. Harding) Pull request description: Clippy recently upgraded and a few two new warnings types popped up in our codebase, fix them both in a single patch so CI passes for all commits. 1. Remove unneeded explicit borrow 2. Use `if let Some` instead of pattern match ACKs for top commit: apoelstra: ACKf5412e2aa2
Kixunil: ACKf5412e2aa2
Tree-SHA512: 1faeb6173061e28a1acfe1a37a669982abbd832b327448e31648c447a7d043841edf30349700ff9da9dd330cfa6d497d188534daab825069e4489653e25987ca
This commit is contained in:
commit
7228d1fc14
|
@ -730,25 +730,25 @@ impl Decodable for CheckedData {
|
|||
// References
|
||||
impl<'a, T: Encodable> Encodable for &'a T {
|
||||
fn consensus_encode<W: io::Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||
(&**self).consensus_encode(w)
|
||||
(**self).consensus_encode(w)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Encodable> Encodable for &'a mut T {
|
||||
fn consensus_encode<W: io::Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||
(&**self).consensus_encode(w)
|
||||
(**self).consensus_encode(w)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Encodable> Encodable for rc::Rc<T> {
|
||||
fn consensus_encode<W: io::Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||
(&**self).consensus_encode(w)
|
||||
(**self).consensus_encode(w)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Encodable> Encodable for sync::Arc<T> {
|
||||
fn consensus_encode<W: io::Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||
(&**self).consensus_encode(w)
|
||||
(**self).consensus_encode(w)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ impl Decodable for PartiallySignedTransaction {
|
|||
global.unsigned_tx_checks()?;
|
||||
|
||||
let inputs: Vec<Input> = {
|
||||
let inputs_len: usize = (&global.unsigned_tx.input).len();
|
||||
let inputs_len: usize = global.unsigned_tx.input.len();
|
||||
|
||||
let mut inputs: Vec<Input> = Vec::with_capacity(inputs_len);
|
||||
|
||||
|
@ -314,7 +314,7 @@ impl Decodable for PartiallySignedTransaction {
|
|||
};
|
||||
|
||||
let outputs: Vec<Output> = {
|
||||
let outputs_len: usize = (&global.unsigned_tx.output).len();
|
||||
let outputs_len: usize = global.unsigned_tx.output.len();
|
||||
|
||||
let mut outputs: Vec<Output> = Vec::with_capacity(outputs_len);
|
||||
|
||||
|
@ -818,7 +818,7 @@ mod tests {
|
|||
assert_eq!(psbt.outputs.len(), 2);
|
||||
|
||||
let tx_input = &psbt.unsigned_tx.input[0];
|
||||
let psbt_non_witness_utxo = (&psbt.inputs[0].non_witness_utxo).as_ref().unwrap();
|
||||
let psbt_non_witness_utxo = psbt.inputs[0].non_witness_utxo.as_ref().unwrap();
|
||||
|
||||
assert_eq!(tx_input.previous_output.txid, psbt_non_witness_utxo.txid());
|
||||
assert!(psbt_non_witness_utxo.output[tx_input.previous_output.vout as usize]
|
||||
|
@ -826,7 +826,7 @@ mod tests {
|
|||
.is_p2pkh()
|
||||
);
|
||||
assert_eq!(
|
||||
(&psbt.inputs[0].sighash_type).as_ref().unwrap().ecdsa_hash_ty().unwrap(),
|
||||
psbt.inputs[0].sighash_type.as_ref().unwrap().ecdsa_hash_ty().unwrap(),
|
||||
EcdsaSighashType::All
|
||||
);
|
||||
}
|
||||
|
|
|
@ -282,13 +282,10 @@ impl TaprootSpendInfo {
|
|||
for leaves in node.leaves {
|
||||
let key = (leaves.script, leaves.ver);
|
||||
let value = leaves.merkle_branch;
|
||||
match info.script_map.get_mut(&key) {
|
||||
Some(set) => {
|
||||
if let Some(set) = info.script_map.get_mut(&key) {
|
||||
set.insert(value);
|
||||
continue; // NLL fix
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
let mut set = BTreeSet::new();
|
||||
set.insert(value);
|
||||
info.script_map.insert(key, set);
|
||||
|
|
Loading…
Reference in New Issue