From c374a77e0dffddc89fa546f2f19a745a09fb2208 Mon Sep 17 00:00:00 2001 From: ryardley Date: Sun, 22 Dec 2024 22:08:24 +1100 Subject: [PATCH] Formatting --- packages/ciphernode/net/src/correlation_id.rs | 2 +- packages/ciphernode/net/src/dialer.rs | 4 ++-- packages/ciphernode/net/src/events.rs | 10 +++------- packages/ciphernode/net/src/network_peer.rs | 2 +- packages/ciphernode/net/src/retry.rs | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/ciphernode/net/src/correlation_id.rs b/packages/ciphernode/net/src/correlation_id.rs index 19dac8db..51265b62 100644 --- a/packages/ciphernode/net/src/correlation_id.rs +++ b/packages/ciphernode/net/src/correlation_id.rs @@ -5,7 +5,7 @@ use std::{ static NEXT_CORRELATION_ID: AtomicUsize = AtomicUsize::new(1); -/// CorrelationId provides a way to correlate commands and the events they create. +/// CorrelationId provides a way to correlate commands and the events they create. #[derive(Debug, Clone)] pub struct CorrelationId { id: usize, diff --git a/packages/ciphernode/net/src/dialer.rs b/packages/ciphernode/net/src/dialer.rs index f11d6396..ba1f6dad 100644 --- a/packages/ciphernode/net/src/dialer.rs +++ b/packages/ciphernode/net/src/dialer.rs @@ -6,10 +6,10 @@ use libp2p::{ swarm::{dial_opts::DialOpts, ConnectionId, DialError}, Multiaddr, }; -use tracing::info; use std::net::ToSocketAddrs; use tokio::sync::{broadcast, mpsc}; use tracing::error; +use tracing::info; use crate::{ events::{NetworkPeerCommand, NetworkPeerEvent}, @@ -78,7 +78,7 @@ async fn attempt_connection( } /// Wait for results of a retry based on a given correlation id and return the correct variant of -/// RetryError depending on the result from the downstream event +/// RetryError depending on the result from the downstream event async fn wait_for_connection( event_rx: &mut broadcast::Receiver, dial_connection: ConnectionId, diff --git a/packages/ciphernode/net/src/events.rs b/packages/ciphernode/net/src/events.rs index 46388372..196ea48f 100644 --- a/packages/ciphernode/net/src/events.rs +++ b/packages/ciphernode/net/src/events.rs @@ -35,14 +35,10 @@ pub enum NetworkPeerEvent { message_id: MessageId, }, /// There was an error Dialing a peer - DialError { - error: Arc, - }, + DialError { error: Arc }, /// A connection was established to a peer - ConnectionEstablished { - connection_id: ConnectionId, - }, - /// There was an error creating a connection + ConnectionEstablished { connection_id: ConnectionId }, + /// There was an error creating a connection OutgoingConnectionError { connection_id: ConnectionId, error: Arc, diff --git a/packages/ciphernode/net/src/network_peer.rs b/packages/ciphernode/net/src/network_peer.rs index e202e061..412ae2b1 100644 --- a/packages/ciphernode/net/src/network_peer.rs +++ b/packages/ciphernode/net/src/network_peer.rs @@ -40,7 +40,7 @@ pub struct NetworkPeer { udp_port: Option, /// The gossipsub topic that the peer should listen on topic: gossipsub::IdentTopic, - /// Broadcast channel to report NetworkPeerEvents to listeners + /// Broadcast channel to report NetworkPeerEvents to listeners event_tx: broadcast::Sender, /// Transmission channel to send NetworkPeerCommands to the NetworkPeer cmd_tx: mpsc::Sender, diff --git a/packages/ciphernode/net/src/retry.rs b/packages/ciphernode/net/src/retry.rs index f45ef27d..a1fdd95e 100644 --- a/packages/ciphernode/net/src/retry.rs +++ b/packages/ciphernode/net/src/retry.rs @@ -1,7 +1,7 @@ use anyhow::Result; -use tracing::{error, warn}; use std::{future::Future, time::Duration}; use tokio::time::sleep; +use tracing::{error, warn}; pub enum RetryError { Failure(anyhow::Error),