Use BoxFuture type alias to avoid clippy's complexity nag

This commit is contained in:
Thomas Eizinger 2021-06-09 11:19:50 +10:00
parent d01e444c90
commit 97a09807dd
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -1,7 +1,6 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use data_encoding::BASE32; use data_encoding::BASE32;
use futures::future::Ready; use futures::future::{BoxFuture, Ready};
use futures::prelude::*;
use libp2p::core::multiaddr::{Multiaddr, Protocol}; use libp2p::core::multiaddr::{Multiaddr, Protocol};
use libp2p::core::transport::TransportError; use libp2p::core::transport::TransportError;
use libp2p::core::Transport; use libp2p::core::Transport;
@ -9,7 +8,6 @@ use libp2p::tcp::tokio::{Tcp, TcpStream};
use libp2p::tcp::{GenTcpConfig, TcpListenStream, TokioTcpConfig}; use libp2p::tcp::{GenTcpConfig, TcpListenStream, TokioTcpConfig};
use std::io; use std::io;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::pin::Pin;
use tokio_socks::tcp::Socks5Stream; use tokio_socks::tcp::Socks5Stream;
use tokio_socks::IntoTargetAddr; use tokio_socks::IntoTargetAddr;
@ -35,8 +33,7 @@ impl Transport for TorTcpConfig {
type Error = io::Error; type Error = io::Error;
type Listener = TcpListenStream<Tcp>; type Listener = TcpListenStream<Tcp>;
type ListenerUpgrade = Ready<Result<Self::Output, Self::Error>>; type ListenerUpgrade = Ready<Result<Self::Output, Self::Error>>;
#[allow(clippy::type_complexity)] type Dial = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type Dial = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send>>;
fn listen_on(self, addr: Multiaddr) -> Result<Self::Listener, TransportError<Self::Error>> { fn listen_on(self, addr: Multiaddr) -> Result<Self::Listener, TransportError<Self::Error>> {
self.inner.listen_on(addr) self.inner.listen_on(addr)