From fcd0f4deac88902e7220c501ff3fa8bf61b78e91 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 25 May 2022 13:15:20 +1000 Subject: [PATCH] Use struct field init shorthand Clippy emits: warning: redundant field names in struct initialization As suggested use struct field init shorthand. --- src/util/address.rs | 2 +- src/util/taproot.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/address.rs b/src/util/address.rs index afa4c714..c8751b5f 100644 --- a/src/util/address.rs +++ b/src/util/address.rs @@ -621,7 +621,7 @@ impl Address { network: Network ) -> Address { Address { - network: network, + network, payload: Payload::p2tr(secp, internal_key, merkle_root), } } diff --git a/src/util/taproot.rs b/src/util/taproot.rs index b1efc1da..b352f92e 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -217,10 +217,10 @@ impl TaprootSpendInfo { ) -> Self { let (output_key, parity) = internal_key.tap_tweak(secp, merkle_root); Self { - internal_key: internal_key, - merkle_root: merkle_root, + internal_key, + merkle_root, output_key_parity: parity, - output_key: output_key, + output_key, script_map: BTreeMap::new(), } } @@ -544,7 +544,7 @@ impl NodeInfo { /// Creates a new [`NodeInfo`] with omitted/hidden info. pub fn new_hidden_node(hash: sha256::Hash) -> Self { Self { - hash: hash, + hash, leaves: vec![], has_hidden_nodes: true } @@ -596,8 +596,8 @@ impl ScriptLeaf { /// Creates an new [`ScriptLeaf`] from `script` and `ver` and no merkle branch. fn new(script: Script, ver: LeafVersion) -> Self { Self { - script: script, - ver: ver, + script, + ver, merkle_branch: TaprootMerkleBranch(vec![]), } }