Skip to content

Commit 958cbbf

Browse files
committed
fix: avoid cloning double reference
Signed-off-by: bestmike007 <[email protected]>
1 parent 7581e6d commit 958cbbf

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5580,9 +5580,7 @@ impl<'a> SortitionHandleTx<'a> {
55805580
hash_tied.sort();
55815581
let winner = hash_tied
55825582
.first()
5583-
.as_ref()
5584-
.expect("FATAL: zero-length list of tied block IDs")
5585-
.clone();
5583+
.expect("FATAL: zero-length list of tied block IDs");
55865584
let winner_index = *mapping
55875585
.get(&winner)
55885586
.expect("FATAL: winning block ID not mapped");

stackslib/src/chainstate/coordinator/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub fn setup_states_with_epochs(
360360
burnchain_blocks_db,
361361
first_sortition.burn_header_hash,
362362
registers,
363-
path.clone(),
363+
*path,
364364
));
365365
} else {
366366
others.push(burnchain_blocks_db);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl TestMinerTrace {
254254
let mut all_test_names = HashSet::new();
255255
for p in self.points.iter() {
256256
for miner_id in p.miner_node_map.keys() {
257-
if let Some(ref test_name) = p.miner_node_map.get(miner_id) {
257+
if let Some(test_name) = p.miner_node_map.get(miner_id) {
258258
if !all_test_names.contains(test_name) {
259259
all_test_names.insert(test_name.clone());
260260
}

stackslib/src/clarity_vm/database/marf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl MarfedKV {
8888
) -> InterpreterResult<MarfedKV> {
8989
let marf = MarfedKV::setup_db(path_str, false, marf_opts)?;
9090
let chain_tip = match miner_tip {
91-
Some(ref miner_tip) => *miner_tip.clone(),
91+
Some(miner_tip) => miner_tip.clone(),
9292
None => StacksBlockId::sentinel(),
9393
};
9494

@@ -102,7 +102,7 @@ impl MarfedKV {
102102
) -> InterpreterResult<MarfedKV> {
103103
let marf = MarfedKV::setup_db(path_str, true, marf_opts)?;
104104
let chain_tip = match miner_tip {
105-
Some(ref miner_tip) => *miner_tip.clone(),
105+
Some(miner_tip) => miner_tip.clone(),
106106
None => StacksBlockId::sentinel(),
107107
};
108108

stackslib/src/net/chat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ impl ConversationP2P {
715715
chain_view: &BurnchainView,
716716
) -> bool {
717717
let bhh = match chain_view.last_burn_block_hashes.get(&block_height) {
718-
Some(ref bhh) => bhh.clone(),
718+
Some(bhh) => bhh,
719719
None => {
720720
// not present; can't prove disagreement (assume the remote peer is just stale)
721721
return false;

stackslib/src/net/neighbors/walk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ impl<DB: NeighborWalkDB, NC: NeighborComms> NeighborWalk<DB, NC> {
442442
);
443443

444444
let (addr, pingback_peer) = match network.get_walk_pingbacks().iter().skip(idx).next() {
445-
Some((ref addr, ref pingback_peer)) => (addr.clone(), pingback_peer.clone()),
445+
Some((addr, pingback_peer)) => (addr, pingback_peer),
446446
None => {
447447
return Err(net_error::NoSuchNeighbor);
448448
}

0 commit comments

Comments
 (0)