Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy::needless_borrowed_ref throughout #5693

Merged
merged 3 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions stackslib/src/chainstate/stacks/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,35 +979,35 @@ impl StacksTransaction {
/// Get the origin account's address
pub fn origin_address(&self) -> StacksAddress {
match (&self.version, &self.auth) {
(&TransactionVersion::Mainnet, &TransactionAuth::Standard(ref origin_condition)) => {
(TransactionVersion::Mainnet, TransactionAuth::Standard(origin_condition)) => {
origin_condition.address_mainnet()
}
(&TransactionVersion::Testnet, &TransactionAuth::Standard(ref origin_condition)) => {
(TransactionVersion::Testnet, TransactionAuth::Standard(origin_condition)) => {
origin_condition.address_testnet()
}
(
&TransactionVersion::Mainnet,
&TransactionAuth::Sponsored(ref origin_condition, ref _unused),
TransactionVersion::Mainnet,
TransactionAuth::Sponsored(origin_condition, _unused),
) => origin_condition.address_mainnet(),
(
&TransactionVersion::Testnet,
&TransactionAuth::Sponsored(ref origin_condition, ref _unused),
TransactionVersion::Testnet,
TransactionAuth::Sponsored(origin_condition, _unused),
) => origin_condition.address_testnet(),
}
}

/// Get the sponsor account's address, if this transaction is sponsored
pub fn sponsor_address(&self) -> Option<StacksAddress> {
match (&self.version, &self.auth) {
(&TransactionVersion::Mainnet, &TransactionAuth::Standard(ref _unused)) => None,
(&TransactionVersion::Testnet, &TransactionAuth::Standard(ref _unused)) => None,
(TransactionVersion::Mainnet, TransactionAuth::Standard(_unused)) => None,
(TransactionVersion::Testnet, TransactionAuth::Standard(_unused)) => None,
(
&TransactionVersion::Mainnet,
&TransactionAuth::Sponsored(ref _unused, ref sponsor_condition),
TransactionVersion::Mainnet,
TransactionAuth::Sponsored(_unused, sponsor_condition),
) => Some(sponsor_condition.address_mainnet()),
(
&TransactionVersion::Testnet,
&TransactionAuth::Sponsored(ref _unused, ref sponsor_condition),
TransactionVersion::Testnet,
TransactionAuth::Sponsored(_unused, sponsor_condition),
) => Some(sponsor_condition.address_testnet()),
}
}
Expand Down
28 changes: 12 additions & 16 deletions stackslib/src/net/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ impl PeerNetwork {
match org_neighbors.get_mut(&org) {
None => {}
Some(ref mut neighbor_infos) => {
neighbor_infos.sort_unstable_by(
|&(ref _nk1, ref stats1), &(ref _nk2, ref stats2)| {
PeerNetwork::compare_neighbor_uptime_health(stats1, stats2)
},
);
neighbor_infos.sort_unstable_by(|(_nk1, stats1), (_nk2, stats2)| {
PeerNetwork::compare_neighbor_uptime_health(stats1, stats2)
});
}
}
}
Expand Down Expand Up @@ -341,17 +339,15 @@ impl PeerNetwork {

// sort in order by first-contact time (oldest first)
for (_, stats_list) in ip_neighbor.iter_mut() {
stats_list.sort_by(
|&(ref _e1, ref _nk1, ref stats1), &(ref _e2, ref _nk2, ref stats2)| {
if stats1.first_contact_time < stats2.first_contact_time {
Ordering::Less
} else if stats1.first_contact_time > stats2.first_contact_time {
Ordering::Greater
} else {
Ordering::Equal
}
},
);
stats_list.sort_by(|(_e1, _nk1, stats1), (_e2, _nk2, stats2)| {
if stats1.first_contact_time < stats2.first_contact_time {
Ordering::Less
} else if stats1.first_contact_time > stats2.first_contact_time {
Ordering::Greater
} else {
Ordering::Equal
}
});
}

let mut to_remove = vec![];
Expand Down
Loading