chore: cargo +nightly clippy --fix -Z unstable-options

This commit is contained in:
Alexander Meißner
2021-06-18 15:34:46 +02:00
committed by Michael Vines
parent 3570b00560
commit 6514096a67
177 changed files with 1021 additions and 1021 deletions

View File

@@ -265,7 +265,7 @@ impl PruneData {
destination: Pubkey::new_unique(),
wallclock,
};
prune_data.sign(&self_keypair);
prune_data.sign(self_keypair);
prune_data
}
}
@@ -1325,7 +1325,7 @@ impl ClusterInfo {
if r_stake == l_stake {
peers[*r_info].id.cmp(&peers[*l_info].id)
} else {
r_stake.cmp(&l_stake)
r_stake.cmp(l_stake)
}
})
.collect();
@@ -1638,7 +1638,7 @@ impl ClusterInfo {
generate_pull_requests: bool,
require_stake_for_gossip: bool,
) -> Vec<(SocketAddr, Protocol)> {
self.trim_crds_table(CRDS_UNIQUE_PUBKEY_CAPACITY, &stakes);
self.trim_crds_table(CRDS_UNIQUE_PUBKEY_CAPACITY, stakes);
// This will flush local pending push messages before generating
// pull-request bloom filters, preventing pull responses to return the
// same values back to the node itself. Note that packets will arrive
@@ -1649,7 +1649,7 @@ impl ClusterInfo {
.add_relaxed(out.len() as u64);
if generate_pull_requests {
let (pings, pull_requests) =
self.new_pull_requests(&thread_pool, gossip_validators, stakes);
self.new_pull_requests(thread_pool, gossip_validators, stakes);
self.stats
.packets_sent_pull_requests_count
.add_relaxed(pull_requests.len() as u64);
@@ -2193,7 +2193,7 @@ impl ClusterInfo {
if !responses.is_empty() {
let timeouts = {
let gossip = self.gossip.read().unwrap();
gossip.make_timeouts(&stakes, epoch_duration)
gossip.make_timeouts(stakes, epoch_duration)
};
for (from, data) in responses {
self.handle_pull_response(&from, data, &timeouts);

View File

@@ -143,14 +143,14 @@ impl ContactInfo {
}
let tpu = *bind_addr;
let gossip = next_port(&bind_addr, 1);
let tvu = next_port(&bind_addr, 2);
let tpu_forwards = next_port(&bind_addr, 3);
let tvu_forwards = next_port(&bind_addr, 4);
let repair = next_port(&bind_addr, 5);
let gossip = next_port(bind_addr, 1);
let tvu = next_port(bind_addr, 2);
let tpu_forwards = next_port(bind_addr, 3);
let tvu_forwards = next_port(bind_addr, 4);
let repair = next_port(bind_addr, 5);
let rpc = SocketAddr::new(bind_addr.ip(), rpc_port::DEFAULT_RPC_PORT);
let rpc_pubsub = SocketAddr::new(bind_addr.ip(), rpc_port::DEFAULT_RPC_PUBSUB_PORT);
let serve_repair = next_port(&bind_addr, 6);
let serve_repair = next_port(bind_addr, 6);
Self {
id: *pubkey,
gossip,

View File

@@ -325,7 +325,7 @@ impl CrdsGossip {
assert!(timeouts.contains_key(&Pubkey::default()));
rv = self
.pull
.purge_active(thread_pool, &mut self.crds, now, &timeouts);
.purge_active(thread_pool, &mut self.crds, now, timeouts);
}
self.crds
.trim_purged(now.saturating_sub(5 * self.pull.crds_timeout));

View File

@@ -277,7 +277,7 @@ impl CrdsGossipPush {
let (weights, peers): (Vec<_>, Vec<_>) = self
.push_options(
crds,
&self_id,
self_id,
self_shred_version,
stakes,
gossip_validators,

View File

@@ -71,7 +71,7 @@ impl Signable for CrdsValue {
fn verify(&self) -> bool {
self.get_signature()
.verify(&self.pubkey().as_ref(), self.signable_data().borrow())
.verify(self.pubkey().as_ref(), self.signable_data().borrow())
}
}
@@ -853,9 +853,9 @@ mod test {
wrong_keypair: &Keypair,
) {
assert!(!value.verify());
value.sign(&correct_keypair);
value.sign(correct_keypair);
assert!(value.verify());
value.sign(&wrong_keypair);
value.sign(wrong_keypair);
assert!(!value.verify());
serialize_deserialize_value(value, correct_keypair);
}

View File

@@ -49,7 +49,7 @@ impl GossipService {
);
let t_receiver = streamer::receiver(
gossip_socket.clone(),
&exit,
exit,
request_sender,
Recycler::default(),
"gossip_receiver",
@@ -319,7 +319,7 @@ fn make_gossip_node(
gossip_socket,
None,
should_check_duplicate_instance,
&exit,
exit,
);
(gossip_service, ip_echo, cluster_info)
}

View File

@@ -225,7 +225,7 @@ fn process_spy(matches: &ArgMatches) -> std::io::Result<()> {
.value_of("node_pubkey")
.map(|pubkey_str| pubkey_str.parse::<Pubkey>().unwrap());
let shred_version = value_t_or_exit!(matches, "shred_version", u16);
let identity_keypair = keypair_of(&matches, "identity").map(Arc::new);
let identity_keypair = keypair_of(matches, "identity").map(Arc::new);
let entrypoint_addr = parse_entrypoint(matches);
@@ -270,7 +270,7 @@ fn parse_entrypoint(matches: &ArgMatches) -> Option<SocketAddr> {
fn process_rpc_url(matches: &ArgMatches) -> std::io::Result<()> {
let any = matches.is_present("any");
let all = matches.is_present("all");
let entrypoint_addr = parse_entrypoint(&matches);
let entrypoint_addr = parse_entrypoint(matches);
let timeout = value_t_or_exit!(matches, "timeout", u64);
let shred_version = value_t_or_exit!(matches, "shred_version", u16);
let (_all_peers, validators) = discover(

View File

@@ -240,7 +240,7 @@ fn connected_staked_network_create(stakes: &[u64]) -> Network {
fn network_simulator_pull_only(thread_pool: &ThreadPool, network: &mut Network) {
let num = network.len();
let (converged, bytes_tx) = network_run_pull(&thread_pool, network, 0, num * 2, 0.9);
let (converged, bytes_tx) = network_run_pull(thread_pool, network, 0, num * 2, 0.9);
trace!(
"network_simulator_pull_{}: converged: {} total_bytes: {}",
num,
@@ -253,7 +253,7 @@ fn network_simulator_pull_only(thread_pool: &ThreadPool, network: &mut Network)
fn network_simulator(thread_pool: &ThreadPool, network: &mut Network, max_convergance: f64) {
let num = network.len();
// run for a small amount of time
let (converged, bytes_tx) = network_run_pull(&thread_pool, network, 0, 10, 1.0);
let (converged, bytes_tx) = network_run_pull(thread_pool, network, 0, 10, 1.0);
trace!("network_simulator_push_{}: converged: {}", num, converged);
// make sure there is someone in the active set
let network_values: Vec<Node> = network.values().cloned().collect();
@@ -292,7 +292,7 @@ fn network_simulator(thread_pool: &ThreadPool, network: &mut Network, max_conver
bytes_tx
);
// pull for a bit
let (converged, bytes_tx) = network_run_pull(&thread_pool, network, start, end, 1.0);
let (converged, bytes_tx) = network_run_pull(thread_pool, network, start, end, 1.0);
total_bytes += bytes_tx;
trace!(
"network_simulator_push_{}: converged: {} bytes: {} total_bytes: {}",
@@ -466,7 +466,7 @@ fn network_run_pull(
.lock()
.unwrap()
.new_pull_request(
&thread_pool,
thread_pool,
from.keypair.deref(),
now,
None,