clippy work

This commit is contained in:
Christien Rioux
2023-09-17 20:45:30 -04:00
parent 6438a64fc7
commit e4ee093951
19 changed files with 350 additions and 234 deletions

View File

@@ -46,7 +46,7 @@ impl RoutingTable {
// Envelope support
let mut envelope_support = Vec::new();
for ess in records[1].split(",") {
for ess in records[1].split(',') {
let ess = ess.trim();
let es = match ess.parse::<u8>() {
Ok(v) => v,
@@ -64,9 +64,9 @@ impl RoutingTable {
// Node Id
let mut node_ids = TypedKeyGroup::new();
for node_id_str in records[2].split(",") {
for node_id_str in records[2].split(',') {
let node_id_str = node_id_str.trim();
let node_id = match TypedKey::from_str(&node_id_str) {
let node_id = match TypedKey::from_str(node_id_str) {
Ok(v) => v,
Err(e) => {
bail!(
@@ -89,7 +89,7 @@ impl RoutingTable {
// Resolve each record and store in node dial infos list
let mut dial_info_details = Vec::new();
for rec in records[4].split(",") {
for rec in records[4].split(',') {
let rec = rec.trim();
let dial_infos = match DialInfo::try_vec_from_short(rec, hostname_str) {
Ok(dis) => dis,
@@ -321,7 +321,7 @@ impl RoutingTable {
// See if we are specifying a direct dialinfo for bootstrap, if so use the direct mechanism
let mut bootstrap_dialinfos = Vec::<DialInfo>::new();
for b in &bootstrap {
if let Ok(bootstrap_di_vec) = DialInfo::try_vec_from_url(&b) {
if let Ok(bootstrap_di_vec) = DialInfo::try_vec_from_url(b) {
for bootstrap_di in bootstrap_di_vec {
bootstrap_dialinfos.push(bootstrap_di);
}

View File

@@ -8,6 +8,9 @@ use futures_util::stream::{FuturesUnordered, StreamExt};
use futures_util::FutureExt;
use stop_token::future::FutureExt as StopFutureExt;
type PingValidatorFuture =
SendPinBoxFuture<Result<NetworkResult<Answer<Option<SenderInfo>>>, RPCError>>;
impl RoutingTable {
// Ping each node in the routing table if they need to be pinged
// to determine their reliability
@@ -16,9 +19,7 @@ impl RoutingTable {
&self,
cur_ts: Timestamp,
relay_nr: NodeRef,
unord: &mut FuturesUnordered<
SendPinBoxFuture<Result<NetworkResult<Answer<Option<SenderInfo>>>, RPCError>>,
>,
unord: &mut FuturesUnordered<PingValidatorFuture>,
) -> EyreResult<()> {
let rpc = self.rpc_processor();
// Get our publicinternet dial info
@@ -123,9 +124,7 @@ impl RoutingTable {
async fn ping_validator_public_internet(
&self,
cur_ts: Timestamp,
unord: &mut FuturesUnordered<
SendPinBoxFuture<Result<NetworkResult<Answer<Option<SenderInfo>>>, RPCError>>,
>,
unord: &mut FuturesUnordered<PingValidatorFuture>,
) -> EyreResult<()> {
let rpc = self.rpc_processor();
@@ -161,9 +160,7 @@ impl RoutingTable {
async fn ping_validator_local_network(
&self,
cur_ts: Timestamp,
unord: &mut FuturesUnordered<
SendPinBoxFuture<Result<NetworkResult<Answer<Option<SenderInfo>>>, RPCError>>,
>,
unord: &mut FuturesUnordered<PingValidatorFuture>,
) -> EyreResult<()> {
let rpc = self.rpc_processor();