Skip to content

Commit 2e8ac08

Browse files
authored
Merge pull request #5643 from jbencin/chore/clippy-1.78-new-lints
chore: Apply new lints in Clippy 1.78 (version 2)
2 parents 8c23c0e + 123ff27 commit 2e8ac08

File tree

18 files changed

+39
-34
lines changed

18 files changed

+39
-34
lines changed

stackslib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = [ "stacks", "stx", "bitcoin", "crypto", "blockstack", "decentralized"
1212
readme = "README.md"
1313
resolver = "2"
1414
edition = "2021"
15-
rust-version = "1.61"
15+
rust-version = "1.80"
1616

1717
[lib]
1818
name = "blockstack_lib"

stackslib/src/chainstate/nakamoto/test_signers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl TestSigners {
264264

265265
let aggregate_public_key: Vec<u8> =
266266
rand::thread_rng().sample_iter(Standard).take(33).collect();
267-
self.aggregate_public_key = aggregate_public_key.clone();
267+
self.aggregate_public_key.clone_from(&aggregate_public_key);
268268
aggregate_public_key
269269
}
270270
}

stackslib/src/chainstate/stacks/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,14 @@ impl StacksBlock {
444444
let mut txids = HashMap::new();
445445
for (i, tx) in txs.iter().enumerate() {
446446
let txid = tx.txid();
447-
if txids.get(&txid).is_some() {
447+
if txids.contains_key(&txid) {
448448
warn!(
449449
"Duplicate tx {}: at index {} and {}",
450450
txid,
451451
txids.get(&txid).unwrap(),
452452
i
453453
);
454-
test_debug!("{:?}", &tx);
454+
test_debug!("{tx:?}");
455455
return false;
456456
}
457457
txids.insert(txid, i);

stackslib/src/chainstate/stacks/index/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl Trie {
281281
)));
282282
}
283283

284-
value.path = cur_leaf.path_bytes().clone();
284+
value.path.clone_from(cur_leaf.path_bytes());
285285

286286
let leaf_hash = get_leaf_hash(value);
287287

stackslib/src/chainstate/stacks/tests/chain_histories.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,7 @@ pub fn mine_invalid_token_transfers_block(
28572857
);
28582858
builder.force_mine_tx(clarity_tx, &tx1).unwrap();
28592859

2860-
if miner.spent_at_nonce.get(&1).is_none() {
2860+
if !miner.spent_at_nonce.contains_key(&1) {
28612861
miner.spent_at_nonce.insert(1, 11111);
28622862
}
28632863

@@ -2871,7 +2871,7 @@ pub fn mine_invalid_token_transfers_block(
28712871
);
28722872
builder.force_mine_tx(clarity_tx, &tx2).unwrap();
28732873

2874-
if miner.spent_at_nonce.get(&2).is_none() {
2874+
if !miner.spent_at_nonce.contains_key(&2) {
28752875
miner.spent_at_nonce.insert(2, 22222);
28762876
}
28772877

stackslib/src/chainstate/stacks/tests/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl TestMinerTrace {
214214
let mut num_blocks = 0;
215215
for p in self.points.iter() {
216216
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) {
218218
num_blocks += 1;
219219
}
220220
}
@@ -227,7 +227,7 @@ impl TestMinerTrace {
227227
let mut num_sortitions = 0;
228228
for p in self.points.iter() {
229229
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) {
231231
num_sortitions += 1;
232232
}
233233
}

stackslib/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ impl BurnchainConfigFile {
14381438
// check magic bytes and set if not defined
14391439
let mainnet_magic = ConfigFile::mainnet().burnchain.unwrap().magic_bytes;
14401440
if self.magic_bytes.is_none() {
1441-
self.magic_bytes = mainnet_magic.clone();
1441+
self.magic_bytes.clone_from(&mainnet_magic);
14421442
}
14431443
if self.magic_bytes != mainnet_magic {
14441444
return Err(format!(

stackslib/src/core/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ fn test_iterate_candidates_concurrent_write_lock() {
12661266
assert_eq!(all_addr_nonces.len(), expected_addr_nonces.len());
12671267

12681268
for (addr, nonce) in all_addr_nonces {
1269-
assert!(expected_addr_nonces.get(&addr).is_some());
1269+
assert!(expected_addr_nonces.contains_key(&addr));
12701270
assert_eq!(nonce, 24);
12711271
}
12721272
}

stackslib/src/net/api/postblock_proposal.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,10 @@ impl NakamotoBlockProposal {
564564
// Clone signatures from block proposal
565565
// These have already been validated by `validate_nakamoto_block_burnchain()``
566566
block.header.miner_signature = self.block.header.miner_signature.clone();
567-
block.header.signer_signature = self.block.header.signer_signature.clone();
567+
block
568+
.header
569+
.signer_signature
570+
.clone_from(&self.block.header.signer_signature);
568571

569572
// Clone the timestamp from the block proposal, which has already been validated
570573
block.header.timestamp = self.block.header.timestamp;

stackslib/src/net/chat.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,8 @@ impl ConversationP2P {
11811181
&mut self,
11821182
stacker_db_data: &StackerDBHandshakeData,
11831183
) {
1184-
self.db_smart_contracts = stacker_db_data.smart_contracts.clone();
1184+
self.db_smart_contracts
1185+
.clone_from(&stacker_db_data.smart_contracts);
11851186
}
11861187

11871188
/// Forget about this peer's stacker DB replication state

0 commit comments

Comments
 (0)