Skip to content

Commit df0f789

Browse files
committed
cargo fmt
1 parent 953ce83 commit df0f789

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

transports/quic/src/config.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
// DEALINGS IN THE SOFTWARE.
2020

2121
use quinn::VarInt;
22-
use std::{
23-
sync::Arc,
24-
time::Duration,
25-
};
22+
use std::{sync::Arc, time::Duration};
2623

2724
/// Config for the transport.
2825
#[derive(Clone)]

transports/quic/src/connection/connecting.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
2323
use crate::{Connection, ConnectionError, Error};
2424

25-
use futures::{prelude::*, future::{Either, select, Select}};
25+
use futures::{
26+
future::{select, Either, Select},
27+
prelude::*,
28+
};
2629
use futures_timer::Delay;
2730
use libp2p_core::PeerId;
2831
use std::{

transports/quic/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@
5757
5858
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
5959

60-
mod connection;
6160
mod config;
61+
mod connection;
6262
mod provider;
6363
mod transport;
6464

65-
pub use connection::{Connecting, Connection, Substream};
6665
pub use config::Config;
66+
pub use connection::{Connecting, Connection, Substream};
6767
#[cfg(feature = "async-std")]
6868
pub use provider::async_std;
6969
#[cfg(feature = "tokio")]

transports/quic/src/transport.rs

+16-14
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
use crate::config::{Config, QuinnConfig};
2222
use crate::provider::Provider;
23-
use crate::{Connecting, ConnectError, Connection, Error};
23+
use crate::{ConnectError, Connecting, Connection, Error};
2424

2525
use futures::future::BoxFuture;
2626
use futures::ready;
@@ -89,7 +89,11 @@ impl<P: Provider> GenTransport<P> {
8989
}
9090
}
9191
/// Create a new [`quinn::Endpoint`] with the given configs.
92-
fn new_endpoint(endpoint_config: quinn::EndpointConfig, server_config: Option<quinn::ServerConfig>, socket_addr: SocketAddr) -> Result<quinn::Endpoint, Error> {
92+
fn new_endpoint(
93+
endpoint_config: quinn::EndpointConfig,
94+
server_config: Option<quinn::ServerConfig>,
95+
socket_addr: SocketAddr,
96+
) -> Result<quinn::Endpoint, Error> {
9397
let socket = UdpSocket::bind(socket_addr)?;
9498
let endpoint = quinn::Endpoint::new(endpoint_config, server_config, socket, P::runtime())?;
9599
Ok(endpoint)
@@ -185,7 +189,8 @@ impl<P: Provider> Transport for GenTransport<P> {
185189
SocketFamily::Ipv6 => SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), 0),
186190
};
187191
let endpoint_config = self.quinn_config.endpoint_config.clone();
188-
let endpoint = Self::new_endpoint(endpoint_config, None, listen_socket_addr)?;
192+
let endpoint =
193+
Self::new_endpoint(endpoint_config, None, listen_socket_addr)?;
189194

190195
vacant.insert(endpoint.clone());
191196
endpoint
@@ -211,7 +216,8 @@ impl<P: Provider> Transport for GenTransport<P> {
211216
// This `"l"` seems necessary because an empty string is an invalid domain
212217
// name. While we don't use domain names, the underlying rustls library
213218
// is based upon the assumption that we do.
214-
let connecting = endpoint.connect_with(client_config, socket_addr, "l")
219+
let connecting = endpoint
220+
.connect_with(client_config, socket_addr, "l")
215221
.map_err(ConnectError)?;
216222
Connecting::new(connecting, handshake_timeout).await
217223
}))
@@ -349,11 +355,9 @@ impl<P: Provider> Listener<P> {
349355
loop {
350356
match ready!(P::poll_if_event(if_watcher, cx)) {
351357
Ok(IfEvent::Up(inet)) => {
352-
if let Some(listen_addr) = ip_to_listenaddr(
353-
&endpoint_addr,
354-
inet.addr(),
355-
self.version,
356-
) {
358+
if let Some(listen_addr) =
359+
ip_to_listenaddr(&endpoint_addr, inet.addr(), self.version)
360+
{
357361
log::debug!("New listen address: {}", listen_addr);
358362
return Poll::Ready(TransportEvent::NewAddress {
359363
listener_id: self.listener_id,
@@ -362,11 +366,9 @@ impl<P: Provider> Listener<P> {
362366
}
363367
}
364368
Ok(IfEvent::Down(inet)) => {
365-
if let Some(listen_addr) = ip_to_listenaddr(
366-
&endpoint_addr,
367-
inet.addr(),
368-
self.version,
369-
) {
369+
if let Some(listen_addr) =
370+
ip_to_listenaddr(&endpoint_addr, inet.addr(), self.version)
371+
{
370372
log::debug!("Expired listen address: {}", listen_addr);
371373
return Poll::Ready(TransportEvent::AddressExpired {
372374
listener_id: self.listener_id,

0 commit comments

Comments
 (0)