Skip to content

Commit 039c155

Browse files
authored
Merge pull request #5693 from stacks-network/fix/clippy-ci-needless-borrowed-ref
Fix clippy::needless_borrowed_ref throughout
2 parents fc92d18 + 2261a86 commit 039c155

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

stackslib/src/chainstate/stacks/transaction.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -979,35 +979,35 @@ impl StacksTransaction {
979979
/// Get the origin account's address
980980
pub fn origin_address(&self) -> StacksAddress {
981981
match (&self.version, &self.auth) {
982-
(&TransactionVersion::Mainnet, &TransactionAuth::Standard(ref origin_condition)) => {
982+
(TransactionVersion::Mainnet, TransactionAuth::Standard(origin_condition)) => {
983983
origin_condition.address_mainnet()
984984
}
985-
(&TransactionVersion::Testnet, &TransactionAuth::Standard(ref origin_condition)) => {
985+
(TransactionVersion::Testnet, TransactionAuth::Standard(origin_condition)) => {
986986
origin_condition.address_testnet()
987987
}
988988
(
989-
&TransactionVersion::Mainnet,
990-
&TransactionAuth::Sponsored(ref origin_condition, ref _unused),
989+
TransactionVersion::Mainnet,
990+
TransactionAuth::Sponsored(origin_condition, _unused),
991991
) => origin_condition.address_mainnet(),
992992
(
993-
&TransactionVersion::Testnet,
994-
&TransactionAuth::Sponsored(ref origin_condition, ref _unused),
993+
TransactionVersion::Testnet,
994+
TransactionAuth::Sponsored(origin_condition, _unused),
995995
) => origin_condition.address_testnet(),
996996
}
997997
}
998998

999999
/// Get the sponsor account's address, if this transaction is sponsored
10001000
pub fn sponsor_address(&self) -> Option<StacksAddress> {
10011001
match (&self.version, &self.auth) {
1002-
(&TransactionVersion::Mainnet, &TransactionAuth::Standard(ref _unused)) => None,
1003-
(&TransactionVersion::Testnet, &TransactionAuth::Standard(ref _unused)) => None,
1002+
(TransactionVersion::Mainnet, TransactionAuth::Standard(_unused)) => None,
1003+
(TransactionVersion::Testnet, TransactionAuth::Standard(_unused)) => None,
10041004
(
1005-
&TransactionVersion::Mainnet,
1006-
&TransactionAuth::Sponsored(ref _unused, ref sponsor_condition),
1005+
TransactionVersion::Mainnet,
1006+
TransactionAuth::Sponsored(_unused, sponsor_condition),
10071007
) => Some(sponsor_condition.address_mainnet()),
10081008
(
1009-
&TransactionVersion::Testnet,
1010-
&TransactionAuth::Sponsored(ref _unused, ref sponsor_condition),
1009+
TransactionVersion::Testnet,
1010+
TransactionAuth::Sponsored(_unused, sponsor_condition),
10111011
) => Some(sponsor_condition.address_testnet()),
10121012
}
10131013
}

stackslib/src/net/prune.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ impl PeerNetwork {
199199
match org_neighbors.get_mut(&org) {
200200
None => {}
201201
Some(ref mut neighbor_infos) => {
202-
neighbor_infos.sort_unstable_by(
203-
|&(ref _nk1, ref stats1), &(ref _nk2, ref stats2)| {
204-
PeerNetwork::compare_neighbor_uptime_health(stats1, stats2)
205-
},
206-
);
202+
neighbor_infos.sort_unstable_by(|(_nk1, stats1), (_nk2, stats2)| {
203+
PeerNetwork::compare_neighbor_uptime_health(stats1, stats2)
204+
});
207205
}
208206
}
209207
}
@@ -341,17 +339,15 @@ impl PeerNetwork {
341339

342340
// sort in order by first-contact time (oldest first)
343341
for (_, stats_list) in ip_neighbor.iter_mut() {
344-
stats_list.sort_by(
345-
|&(ref _e1, ref _nk1, ref stats1), &(ref _e2, ref _nk2, ref stats2)| {
346-
if stats1.first_contact_time < stats2.first_contact_time {
347-
Ordering::Less
348-
} else if stats1.first_contact_time > stats2.first_contact_time {
349-
Ordering::Greater
350-
} else {
351-
Ordering::Equal
352-
}
353-
},
354-
);
342+
stats_list.sort_by(|(_e1, _nk1, stats1), (_e2, _nk2, stats2)| {
343+
if stats1.first_contact_time < stats2.first_contact_time {
344+
Ordering::Less
345+
} else if stats1.first_contact_time > stats2.first_contact_time {
346+
Ordering::Greater
347+
} else {
348+
Ordering::Equal
349+
}
350+
});
355351
}
356352

357353
let mut to_remove = vec![];

0 commit comments

Comments
 (0)