Skip to content

Commit 5f28c47

Browse files
authored
Merge pull request #2055 from mintlayer/appease_clippy_1.95
Fix clippy 1.95 errors
2 parents 2cf4216 + 7635e1a commit 5f28c47

17 files changed

Lines changed: 28 additions & 32 deletions

File tree

api-server/api-server-common/src/storage/impls/in_memory/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl ApiServerInMemoryStorage {
190190
.address_transactions_table
191191
.get(address)
192192
.map_or_else(Vec::new, |transactions| {
193-
transactions.iter().flat_map(|(_, txs)| txs.iter()).cloned().collect()
193+
transactions.values().flat_map(|txs| txs.iter()).cloned().collect()
194194
}))
195195
}
196196

blockprod/src/detail/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ mod produce_block {
13641364
let origin = LocalTxOrigin::Mempool;
13651365
let options = TxOptions::default_for(origin.into());
13661366

1367-
for tx in std::iter::once(main_tx).chain(dependent_txs.into_iter()) {
1367+
for tx in std::iter::once(main_tx).chain(dependent_txs) {
13681368
mp.add_transaction_local(tx, origin, options.clone()).unwrap();
13691369
}
13701370
}

chainstate/db-dumper/src/dumper_lib/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn dump_blocks_random(
266266
}
267267

268268
infos.shuffle(&mut rng);
269-
infos.sort_by(|b1, b2| b1.input_info.height.cmp(&b2.input_info.height));
269+
infos.sort_by_key(|b| b.input_info.height);
270270
}
271271

272272
infos

chainstate/src/detail/block_invalidation/best_chain_candidates_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ mod test_framework {
367367
}
368368
})
369369
.collect();
370-
ids_heights.sort_by(|(_, height1), (_, height2)| height1.cmp(height2));
370+
ids_heights.sort_by_key(|(_, height)| *height);
371371
Ok(ids_heights.iter().map(|(id, _)| *id).collect())
372372
}
373373

chainstate/src/detail/chainstateref/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,10 +1002,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
10021002
start_from: BlockHeight,
10031003
) -> Result<Vec<Id<Block>>, PropertyQueryError> {
10041004
let block_tree_map = self.db_tx.get_block_tree_by_height(start_from)?;
1005-
let result = block_tree_map
1006-
.into_iter()
1007-
.flat_map(|(_height, ids_per_height)| ids_per_height)
1008-
.collect();
1005+
let result = block_tree_map.into_values().flatten().collect();
10091006
Ok(result)
10101007
}
10111008

common/src/chain/config/regtest_options.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ pub fn regtest_chain_config_builder(options: &ChainConfigOptions) -> Result<Buil
168168
update_builder!(max_block_size_with_standard_txs);
169169
update_builder!(max_block_size_with_smart_contracts);
170170

171-
let chain_initial_difficulty = chain_initial_difficulty
172-
.map(primitives::Compact)
173-
.unwrap_or(pos_initial_difficulty(ChainType::Regtest).into());
171+
let chain_initial_difficulty = chain_initial_difficulty.map_or(
172+
pos_initial_difficulty(ChainType::Regtest).into(),
173+
primitives::Compact,
174+
);
174175

175176
if let Some(upgrade_height) = chain_pos_netupgrades {
176177
builder = builder

node-gui/src/widgets/esc_handler.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,14 @@ where
124124
viewport: &Rectangle,
125125
) -> event::Status {
126126
let event_captured = match &event {
127-
Event::Keyboard(keyboard::Event::KeyPressed { key, .. }) => {
128-
if *key == keyboard::Key::Named(keyboard::key::Named::Escape) {
129-
if let Some(msg) = &self.msg_to_emit {
130-
shell.publish(msg.clone());
131-
}
132-
133-
true
134-
} else {
135-
false
127+
Event::Keyboard(keyboard::Event::KeyPressed { key, .. })
128+
if *key == keyboard::Key::Named(keyboard::key::Named::Escape) =>
129+
{
130+
if let Some(msg) = &self.msg_to_emit {
131+
shell.publish(msg.clone());
136132
}
133+
134+
true
137135
}
138136
_ => false,
139137
};

p2p/src/peer_manager/tests/connections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,7 @@ async fn feeler_connections_test_impl(seed: Seed) {
19121912
10,
19131913
&mut rng,
19141914
);
1915-
let mut addresses = BTreeSet::from_iter(addresses.into_iter());
1915+
let mut addresses = BTreeSet::from_iter(addresses);
19161916
for addr in &addresses {
19171917
peer_mgr.peerdb.peer_discovered(*addr);
19181918
}

p2p/src/sync/peer/block_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ where
585585
// two versions of incoming.requested_blocks, one for the most recent request and
586586
// another one for the previous request(s), so that it can distinguish previously
587587
// requested blocks that were "cancelled" in-flight from unsolicited ones.
588-
self.outgoing.blocks_queue.extend(block_ids.into_iter());
588+
self.outgoing.blocks_queue.extend(block_ids);
589589

590590
Ok(())
591591
}

p2p/src/tests/helpers/test_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ where
394394
.peers()
395395
.values()
396396
.map(|ctx| ctx.peer_address)
397-
.chain(peer_mgr.pending_outbound_conn_addrs().into_iter())
397+
.chain(peer_mgr.pending_outbound_conn_addrs())
398398
.collect()
399399
})
400400
.await

0 commit comments

Comments
 (0)