File tree Expand file tree Collapse file tree 10 files changed +20
-20
lines changed Expand file tree Collapse file tree 10 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -444,14 +444,14 @@ impl StacksBlock {
444
444
let mut txids = HashMap :: new ( ) ;
445
445
for ( i, tx) in txs. iter ( ) . enumerate ( ) {
446
446
let txid = tx. txid ( ) ;
447
- if txids. get ( & txid) . is_some ( ) {
447
+ if txids. contains_key ( & txid) {
448
448
warn ! (
449
449
"Duplicate tx {}: at index {} and {}" ,
450
450
txid,
451
451
txids. get( & txid) . unwrap( ) ,
452
452
i
453
453
) ;
454
- test_debug ! ( "{:?}" , & tx ) ;
454
+ test_debug ! ( "{tx :?}" ) ;
455
455
return false ;
456
456
}
457
457
txids. insert ( txid, i) ;
Original file line number Diff line number Diff line change @@ -2857,7 +2857,7 @@ pub fn mine_invalid_token_transfers_block(
2857
2857
) ;
2858
2858
builder. force_mine_tx ( clarity_tx, & tx1) . unwrap ( ) ;
2859
2859
2860
- if miner. spent_at_nonce . get ( & 1 ) . is_none ( ) {
2860
+ if ! miner. spent_at_nonce . contains_key ( & 1 ) {
2861
2861
miner. spent_at_nonce . insert ( 1 , 11111 ) ;
2862
2862
}
2863
2863
@@ -2871,7 +2871,7 @@ pub fn mine_invalid_token_transfers_block(
2871
2871
) ;
2872
2872
builder. force_mine_tx ( clarity_tx, & tx2) . unwrap ( ) ;
2873
2873
2874
- if miner. spent_at_nonce . get ( & 2 ) . is_none ( ) {
2874
+ if ! miner. spent_at_nonce . contains_key ( & 2 ) {
2875
2875
miner. spent_at_nonce . insert ( 2 , 22222 ) ;
2876
2876
}
2877
2877
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ impl TestMinerTrace {
214
214
let mut num_blocks = 0 ;
215
215
for p in self . points . iter ( ) {
216
216
for miner_id in p. stacks_blocks . keys ( ) {
217
- if p. stacks_blocks . get ( miner_id) . is_some ( ) {
217
+ if p. stacks_blocks . contains_key ( miner_id) {
218
218
num_blocks += 1 ;
219
219
}
220
220
}
@@ -227,7 +227,7 @@ impl TestMinerTrace {
227
227
let mut num_sortitions = 0 ;
228
228
for p in self . points . iter ( ) {
229
229
for miner_id in p. fork_snapshots . keys ( ) {
230
- if p. fork_snapshots . get ( miner_id) . is_some ( ) {
230
+ if p. fork_snapshots . contains_key ( miner_id) {
231
231
num_sortitions += 1 ;
232
232
}
233
233
}
Original file line number Diff line number Diff line change @@ -1266,7 +1266,7 @@ fn test_iterate_candidates_concurrent_write_lock() {
1266
1266
assert_eq ! ( all_addr_nonces. len( ) , expected_addr_nonces. len( ) ) ;
1267
1267
1268
1268
for ( addr, nonce) in all_addr_nonces {
1269
- assert ! ( expected_addr_nonces. get ( & addr) . is_some ( ) ) ;
1269
+ assert ! ( expected_addr_nonces. contains_key ( & addr) ) ;
1270
1270
assert_eq ! ( nonce, 24 ) ;
1271
1271
}
1272
1272
}
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ impl InvGenerator {
241
241
tenure_id_consensus_hash : & ConsensusHash ,
242
242
) -> Result < Option < InvTenureInfo > , NetError > {
243
243
let tip_block_id = StacksBlockId :: new ( tip_block_ch, tip_block_bh) ;
244
- if self . processed_tenures . get ( & tip_block_id) . is_none ( ) {
244
+ if ! self . processed_tenures . contains_key ( & tip_block_id) {
245
245
// this tip has no known table.
246
246
// does it have an ancestor with a table? If so, then move its ancestor's table to this
247
247
// tip. Otherwise, make a new table.
Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ impl RelayerStats {
406
406
// look up ASNs
407
407
let mut asns = HashMap :: new ( ) ;
408
408
for nk in neighbors. iter ( ) {
409
- if asns. get ( nk) . is_none ( ) {
409
+ if ! asns. contains_key ( nk) {
410
410
match PeerDB :: asn_lookup ( conn, & nk. addrbytes ) ? {
411
411
Some ( asn) => asns. insert ( ( * nk) . clone ( ) , asn) ,
412
412
None => asns. insert ( ( * nk) . clone ( ) , 0 ) ,
@@ -1150,7 +1150,7 @@ impl Relayer {
1150
1150
1151
1151
for ( anchored_block_hash, ( relayers, mblocks_map) ) in new_microblocks. into_iter ( ) {
1152
1152
for ( _, mblock) in mblocks_map. into_iter ( ) {
1153
- if mblocks_data. get ( & anchored_block_hash) . is_none ( ) {
1153
+ if ! mblocks_data. contains_key ( & anchored_block_hash) {
1154
1154
mblocks_data. insert ( anchored_block_hash. clone ( ) , vec ! [ ] ) ;
1155
1155
}
1156
1156
Original file line number Diff line number Diff line change @@ -1182,7 +1182,7 @@ fn test_tenure_start_end_from_inventory() {
1182
1182
for ( i, wt) in wanted_tenures. iter ( ) . enumerate ( ) {
1183
1183
if i >= ( rc_len - 1 ) . into ( ) {
1184
1184
// nothing here
1185
- assert ! ( available. get ( & wt. tenure_id_consensus_hash) . is_none ( ) ) ;
1185
+ assert ! ( ! available. contains_key ( & wt. tenure_id_consensus_hash) ) ;
1186
1186
continue ;
1187
1187
}
1188
1188
Original file line number Diff line number Diff line change @@ -767,11 +767,11 @@ fn test_http_response_type_codec() {
767
767
match preamble {
768
768
StacksHttpPreamble :: Response ( ref mut req) => {
769
769
assert_eq ! ( req. headers. len( ) , 5 ) ;
770
- assert ! ( req. headers. get ( "access-control-allow-headers" ) . is_some ( ) ) ;
771
- assert ! ( req. headers. get ( "access-control-allow-methods" ) . is_some ( ) ) ;
772
- assert ! ( req. headers. get ( "access-control-allow-origin" ) . is_some ( ) ) ;
773
- assert ! ( req. headers. get ( "server" ) . is_some ( ) ) ;
774
- assert ! ( req. headers. get ( "date" ) . is_some ( ) ) ;
770
+ assert ! ( req. headers. contains_key ( "access-control-allow-headers" ) ) ;
771
+ assert ! ( req. headers. contains_key ( "access-control-allow-methods" ) ) ;
772
+ assert ! ( req. headers. contains_key ( "access-control-allow-origin" ) ) ;
773
+ assert ! ( req. headers. contains_key ( "server" ) ) ;
774
+ assert ! ( req. headers. contains_key ( "date" ) ) ;
775
775
req. headers . clear ( ) ;
776
776
}
777
777
StacksHttpPreamble :: Request ( _) => {
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ fn test_mempool_sync_2_peers() {
307
307
// peer 2 has none of the old ones
308
308
for tx in peer_2_mempool_txs {
309
309
assert_eq ! ( & tx. tx, txs. get( & tx. tx. txid( ) ) . unwrap( ) ) ;
310
- assert ! ( old_txs. get ( & tx. tx. txid( ) ) . is_none ( ) ) ;
310
+ assert ! ( ! old_txs. contains_key ( & tx. tx. txid( ) ) ) ;
311
311
}
312
312
}
313
313
Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ fn test_step_walk_1_neighbor_bootstrapping() {
581
581
assert_eq ! ( w. result. replaced_neighbors. len( ) , 0 ) ;
582
582
583
583
// peer 2 never gets added to peer 1's frontier
584
- assert ! ( w. frontier. get ( & neighbor_2. addr) . is_none ( ) ) ;
584
+ assert ! ( ! w. frontier. contains_key ( & neighbor_2. addr) ) ;
585
585
}
586
586
None => { }
587
587
} ;
@@ -597,7 +597,7 @@ fn test_step_walk_1_neighbor_bootstrapping() {
597
597
i += 1 ;
598
598
}
599
599
600
- debug ! ( "Completed walk round {} step(s)" , i ) ;
600
+ debug ! ( "Completed walk round {i } step(s)" ) ;
601
601
602
602
// peer 1 contacted peer 2
603
603
let stats_1 = peer_1
@@ -673,7 +673,7 @@ fn test_step_walk_1_neighbor_behind() {
673
673
assert_eq ! ( w. result. replaced_neighbors. len( ) , 0 ) ;
674
674
675
675
// peer 1 never gets added to peer 2's frontier
676
- assert ! ( w. frontier. get ( & neighbor_1. addr) . is_none ( ) ) ;
676
+ assert ! ( ! w. frontier. contains_key ( & neighbor_1. addr) ) ;
677
677
}
678
678
None => { }
679
679
} ;
You can’t perform that action at this time.
0 commit comments