Skip to content

Commit 0e9e09f

Browse files
authored
Merge pull request #5627 from stacks-network/fix/clippy-ci-stacks-lib-redundant-field-names
Fix all redundant_field_name warnings in stackslib
2 parents eb97dd9 + a24f445 commit 0e9e09f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+300
-329
lines changed

stackslib/src/burnchains/bitcoin/address.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ impl LegacyBitcoinAddress {
234234
payload_bytes.copy_from_slice(b);
235235

236236
Ok(LegacyBitcoinAddress {
237-
network_id: network_id,
238-
addrtype: addrtype,
237+
network_id,
238+
addrtype,
239239
bytes: Hash160(payload_bytes),
240240
})
241241
}
@@ -436,8 +436,8 @@ impl BitcoinAddress {
436436
my_bytes.copy_from_slice(b);
437437

438438
Ok(BitcoinAddress::Legacy(LegacyBitcoinAddress {
439-
network_id: network_id,
440-
addrtype: addrtype,
439+
network_id,
440+
addrtype,
441441
bytes: Hash160(my_bytes),
442442
}))
443443
}
@@ -478,7 +478,7 @@ impl BitcoinAddress {
478478
my_bytes.copy_from_slice(b);
479479

480480
Some(BitcoinAddress::Legacy(LegacyBitcoinAddress {
481-
network_id: network_id,
481+
network_id,
482482
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
483483
bytes: Hash160(my_bytes),
484484
}))
@@ -492,7 +492,7 @@ impl BitcoinAddress {
492492
my_bytes.copy_from_slice(b);
493493

494494
Some(BitcoinAddress::Legacy(LegacyBitcoinAddress {
495-
network_id: network_id,
495+
network_id,
496496
addrtype: LegacyBitcoinAddressType::ScriptHash,
497497
bytes: Hash160(my_bytes),
498498
}))

stackslib/src/burnchains/bitcoin/bits.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl BitcoinTxInputStructured {
136136

137137
Some(BitcoinTxInputStructured {
138138
tx_ref: input_txid,
139-
keys: keys,
139+
keys,
140140
num_required: num_sigs,
141141
in_type: if segwit {
142142
BitcoinInputType::SegwitP2SH
@@ -184,7 +184,7 @@ impl BitcoinTxInputStructured {
184184

185185
let tx_input = BitcoinTxInputStructured {
186186
tx_ref: input_txid,
187-
keys: keys,
187+
keys,
188188
num_required: num_sigs,
189189
in_type: BitcoinInputType::SegwitP2SH,
190190
};
@@ -498,7 +498,7 @@ impl BitcoinTxInputRaw {
498498
) -> BitcoinTxInputRaw {
499499
BitcoinTxInputRaw {
500500
scriptSig: script_sig.clone().into_bytes(),
501-
witness: witness,
501+
witness,
502502
tx_ref: input_txid,
503503
}
504504
}

stackslib/src/burnchains/bitcoin/blocks.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl BitcoinBlockParser {
231231
/// New block parser
232232
pub fn new(network_id: BitcoinNetworkType, magic_bytes: MagicBytes) -> BitcoinBlockParser {
233233
BitcoinBlockParser {
234-
network_id: network_id,
234+
network_id,
235235
magic_bytes: magic_bytes.clone(),
236236
}
237237
}
@@ -478,7 +478,7 @@ impl BitcoinBlockParser {
478478
}
479479

480480
BitcoinBlock {
481-
block_height: block_height,
481+
block_height,
482482
block_hash: BurnchainHeaderHash::from_bitcoin_hash(&block.bitcoin_hash()),
483483
parent_block_hash: BurnchainHeaderHash::from_bitcoin_hash(&block.header.prev_blockhash),
484484
txs: accepted_txs,
@@ -596,7 +596,7 @@ mod tests {
596596
let header =
597597
deserialize(&header_bin.to_vec()).map_err(|_e| "failed to deserialize header")?;
598598
Ok(LoneBlockHeader {
599-
header: header,
599+
header,
600600
tx_count: VarInt(0),
601601
})
602602
}
@@ -655,7 +655,7 @@ mod tests {
655655
result: Some(BitcoinTransaction {
656656
data_amt: 0,
657657
txid: to_txid(&hex_bytes("185c112401590b11acdfea6bb26d2a8e37cb31f24a0c89dbb8cc14b3d6271fb1").unwrap()),
658-
vtxindex: vtxindex,
658+
vtxindex,
659659
opcode: '+' as u8,
660660
data: hex_bytes("fae543ff5672fb607fe15e16b1c3ef38737c631c7c5d911c6617993c21fba731363f1cfe").unwrap(),
661661
inputs: vec![
@@ -702,7 +702,7 @@ mod tests {
702702
result: Some(BitcoinTransaction {
703703
data_amt: 0,
704704
txid: to_txid(&hex_bytes("eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f").unwrap()),
705-
vtxindex: vtxindex,
705+
vtxindex,
706706
opcode: '~' as u8,
707707
data: hex_bytes("7061747269636b7374616e6c6579322e6964").unwrap(),
708708
inputs: vec![
@@ -745,7 +745,7 @@ mod tests {
745745
result: Some(BitcoinTransaction {
746746
data_amt: 0,
747747
txid: to_txid(&hex_bytes("b908952b30ccfdfa59985dc1ffdd2a22ef054d20fa253510d2af7797dddee459").unwrap()),
748-
vtxindex: vtxindex,
748+
vtxindex,
749749
opcode: ':' as u8,
750750
data: hex_bytes("666f6f2e74657374").unwrap(),
751751
inputs: vec![
@@ -776,7 +776,7 @@ mod tests {
776776
result: Some(BitcoinTransaction {
777777
data_amt: 0,
778778
txid: to_txid(&hex_bytes("16751ca54407b922e3072830cf4be58c5562a6dc350f6703192b673c4cc86182").unwrap()),
779-
vtxindex: vtxindex,
779+
vtxindex,
780780
opcode: '?' as u8,
781781
data: hex_bytes("9fab7f294936ddb6524a48feff691ecbd0ca9e8f107d845c417a5438d1cb441e827c5126").unwrap(),
782782
inputs: vec![
@@ -826,7 +826,7 @@ mod tests {
826826
result: Some(BitcoinTransaction {
827827
data_amt: 0,
828828
txid: to_txid(&hex_bytes("185c112401590b11acdfea6bb26d2a8e37cb31f24a0c89dbb8cc14b3d6271fb1").unwrap()),
829-
vtxindex: vtxindex,
829+
vtxindex,
830830
opcode: '+' as u8,
831831
data: hex_bytes("fae543ff5672fb607fe15e16b1c3ef38737c631c7c5d911c6617993c21fba731363f1cfe").unwrap(),
832832
inputs: vec![
@@ -864,7 +864,7 @@ mod tests {
864864
result: Some(BitcoinTransaction {
865865
data_amt: 0,
866866
txid: to_txid(&hex_bytes("eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f").unwrap()),
867-
vtxindex: vtxindex,
867+
vtxindex,
868868
opcode: '~' as u8,
869869
data: hex_bytes("7061747269636b7374616e6c6579322e6964").unwrap(),
870870
inputs: vec![
@@ -897,7 +897,7 @@ mod tests {
897897
result: Some(BitcoinTransaction {
898898
data_amt: 0,
899899
txid: to_txid(&hex_bytes("b908952b30ccfdfa59985dc1ffdd2a22ef054d20fa253510d2af7797dddee459").unwrap()),
900-
vtxindex: vtxindex,
900+
vtxindex,
901901
opcode: ':' as u8,
902902
data: hex_bytes("666f6f2e74657374").unwrap(),
903903
inputs: vec![
@@ -928,7 +928,7 @@ mod tests {
928928
result: Some(BitcoinTransaction {
929929
data_amt: 0,
930930
txid: to_txid(&hex_bytes("16751ca54407b922e3072830cf4be58c5562a6dc350f6703192b673c4cc86182").unwrap()),
931-
vtxindex: vtxindex,
931+
vtxindex,
932932
opcode: '?' as u8,
933933
data: hex_bytes("9fab7f294936ddb6524a48feff691ecbd0ca9e8f107d845c417a5438d1cb441e827c5126").unwrap(),
934934
inputs: vec![
@@ -961,7 +961,7 @@ mod tests {
961961
result: Some(BitcoinTransaction {
962962
data_amt: 0,
963963
txid: to_txid(&hex_bytes("8b8a12909d48fd86c06e92270133d320498fb36caa0fdcb3292a8bba99669ebd").unwrap()),
964-
vtxindex: vtxindex,
964+
vtxindex,
965965
opcode: '&' as u8,
966966
data: hex_bytes("0000cd73fa046543210000000000aa000174657374").unwrap(),
967967
inputs: vec![

stackslib/src/burnchains/bitcoin/indexer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl BitcoinIndexerConfig {
160160
username: Some("blockstack".to_string()),
161161
password: Some("blockstacksystem".to_string()),
162162
timeout: 30,
163-
spv_headers_path: spv_headers_path,
163+
spv_headers_path,
164164
first_block: 0,
165165
magic_bytes: BLOCKSTACK_MAGIC_MAINNET.clone(),
166166
epochs: None,
@@ -193,7 +193,7 @@ impl BitcoinIndexerRuntime {
193193
services: 0,
194194
user_agent: USER_AGENT.to_owned(),
195195
version_nonce: rng.gen(),
196-
network_id: network_id,
196+
network_id,
197197
block_height: 0,
198198
last_getdata_send_time: 0,
199199
last_getheaders_send_time: 0,

stackslib/src/burnchains/bitcoin/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ impl BitcoinBlock {
239239
block_height: height,
240240
block_hash: hash.clone(),
241241
parent_block_hash: parent.clone(),
242-
txs: txs,
243-
timestamp: timestamp,
242+
txs,
243+
timestamp,
244244
}
245245
}
246246
}

stackslib/src/burnchains/bitcoin/network.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl BitcoinIndexer {
4545
pub fn send_message(&mut self, payload: btc_message::NetworkMessage) -> Result<(), btc_error> {
4646
let message = btc_message::RawNetworkMessage {
4747
magic: network_id_to_bytes(self.runtime.network_id),
48-
payload: payload,
48+
payload,
4949
};
5050

5151
self.with_socket(|ref mut sock| {
@@ -245,7 +245,7 @@ impl BitcoinIndexer {
245245
let payload = btc_message_network::VersionMessage {
246246
version: btc_constants::PROTOCOL_VERSION,
247247
services: 0,
248-
timestamp: timestamp,
248+
timestamp,
249249
receiver: remote_address,
250250
sender: sender_address,
251251
nonce: self.runtime.version_nonce,

stackslib/src/burnchains/bitcoin/spv.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ impl SpvClient {
167167
start_block_height: start_block,
168168
end_block_height: end_block,
169169
cur_block_height: start_block,
170-
network_id: network_id,
171-
readwrite: readwrite,
172-
reverse_order: reverse_order,
170+
network_id,
171+
readwrite,
172+
reverse_order,
173173
headers_db: conn,
174174
check_txcount: true,
175175
};
@@ -197,9 +197,9 @@ impl SpvClient {
197197
start_block_height: start_block,
198198
end_block_height: end_block,
199199
cur_block_height: start_block,
200-
network_id: network_id,
201-
readwrite: readwrite,
202-
reverse_order: reverse_order,
200+
network_id,
201+
readwrite,
202+
reverse_order,
203203
headers_db: conn,
204204
check_txcount: true,
205205
};

stackslib/src/burnchains/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl FromRow<BlockCommitMetadata> for BlockCommitMetadata {
132132
block_height,
133133
vtxindex,
134134
affirmation_id,
135-
anchor_block: anchor_block,
135+
anchor_block,
136136
anchor_block_descendant,
137137
})
138138
}
@@ -1106,7 +1106,7 @@ impl BurnchainDB {
11061106

11071107
pub fn tx_begin<'a>(&'a mut self) -> Result<BurnchainDBTransaction<'a>, BurnchainError> {
11081108
let sql_tx = tx_begin_immediate(&mut self.conn)?;
1109-
Ok(BurnchainDBTransaction { sql_tx: sql_tx })
1109+
Ok(BurnchainDBTransaction { sql_tx })
11101110
}
11111111

11121112
fn inner_get_canonical_chain_tip(

stackslib/src/burnchains/tests/affirmation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ pub fn make_simple_key_register(
249249
memo: vec![01, 02, 03, 04, 05],
250250

251251
txid: next_txid(),
252-
vtxindex: vtxindex,
253-
block_height: block_height,
252+
vtxindex,
253+
block_height,
254254
burn_header_hash: burn_header_hash.clone(),
255255
}
256256
}

stackslib/src/burnchains/tests/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ pub fn make_simple_block_commit(
545545

546546
txid: next_txid(),
547547
vtxindex: 0,
548-
block_height: block_height,
548+
block_height,
549549
burn_parent_modulus: ((block_height - 1) % BURN_BLOCK_MINED_AT_MODULUS) as u8,
550550
burn_header_hash: burn_header.block_hash.clone(),
551551
};

0 commit comments

Comments
 (0)