Skip to content

Commit ac8a470

Browse files
committed
chore: Apply Clippy lint assigning_clones
1 parent 5fb8f66 commit ac8a470

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

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/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/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/net/api/postblock_proposal.rs

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

567570
// Clone the timestamp from the block proposal, which has already been validated
568571
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

stackslib/src/net/p2p.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl PeerNetwork {
474474
);
475475
let pub_ip = connection_opts.public_ip_address.clone();
476476
let pub_ip_learned = pub_ip.is_none();
477-
local_peer.public_ip_address = pub_ip.clone();
477+
local_peer.public_ip_address.clone_from(&pub_ip);
478478

479479
if connection_opts.disable_inbound_handshakes {
480480
debug!("{:?}: disable inbound handshakes", &local_peer);
@@ -4119,7 +4119,8 @@ impl PeerNetwork {
41194119
/// Get the local peer from the peer DB, but also preserve the public IP address
41204120
pub fn load_local_peer(&self) -> Result<LocalPeer, net_error> {
41214121
let mut lp = PeerDB::get_local_peer(&self.peerdb.conn())?;
4122-
lp.public_ip_address = self.local_peer.public_ip_address.clone();
4122+
lp.public_ip_address
4123+
.clone_from(&self.local_peer.public_ip_address);
41234124
Ok(lp)
41244125
}
41254126

0 commit comments

Comments
 (0)