mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-26 16:21:39 +00:00
Fix some rustc/clippy warnings. (#895)
This commit is contained in:
@ -75,7 +75,7 @@ where
|
||||
{
|
||||
let protocols = protocols.into_iter();
|
||||
DialerSelectSeq {
|
||||
inner: DialerSelectSeqState::AwaitDialer { dialer_fut: Dialer::new(inner), protocols }
|
||||
inner: DialerSelectSeqState::AwaitDialer { dialer_fut: Dialer::dial(inner), protocols }
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ where
|
||||
{
|
||||
let protocols = protocols.into_iter();
|
||||
DialerSelectPar {
|
||||
inner: DialerSelectParState::AwaitDialer { dialer_fut: Dialer::new(inner), protocols }
|
||||
inner: DialerSelectParState::AwaitDialer { dialer_fut: Dialer::dial(inner), protocols }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ mod length_delimited;
|
||||
mod listener_select;
|
||||
mod tests;
|
||||
|
||||
pub mod protocol;
|
||||
mod protocol;
|
||||
|
||||
pub use self::dialer_select::{dialer_select_proto, DialerSelectFuture};
|
||||
pub use self::error::ProtocolChoiceError;
|
||||
|
@ -55,8 +55,8 @@ where
|
||||
{
|
||||
ListenerSelectFuture {
|
||||
inner: ListenerSelectState::AwaitListener {
|
||||
listener_fut: Listener::new(inner),
|
||||
protocols: protocols
|
||||
listener_fut: Listener::listen(inner),
|
||||
protocols
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
N: AsRef<[u8]>
|
||||
{
|
||||
pub fn new(inner: R) -> DialerFuture<R, N> {
|
||||
pub fn dial(inner: R) -> DialerFuture<R, N> {
|
||||
let codec = MessageEncoder(std::marker::PhantomData);
|
||||
let sender = LengthDelimited::new(inner, codec);
|
||||
DialerFuture {
|
||||
@ -223,7 +223,7 @@ mod tests {
|
||||
|
||||
let client = TcpStream::connect(&listener_addr)
|
||||
.from_err()
|
||||
.and_then(move |stream| Dialer::new(stream))
|
||||
.and_then(move |stream| Dialer::dial(stream))
|
||||
.and_then(move |dialer| {
|
||||
let p = b"invalid_name";
|
||||
dialer.send(DialerToListenerMessage::ProtocolRequest { name: p })
|
||||
|
@ -46,7 +46,7 @@ where
|
||||
{
|
||||
/// Takes ownership of a socket and starts the handshake. If the handshake succeeds, the
|
||||
/// future returns a `Listener`.
|
||||
pub fn new(inner: R) -> ListenerFuture<R, N> {
|
||||
pub fn listen(inner: R) -> ListenerFuture<R, N> {
|
||||
let codec = MessageEncoder(std::marker::PhantomData);
|
||||
let inner = LengthDelimited::new(inner, codec);
|
||||
ListenerFuture {
|
||||
@ -258,7 +258,7 @@ mod tests {
|
||||
.incoming()
|
||||
.into_future()
|
||||
.map_err(|(e, _)| e.into())
|
||||
.and_then(move |(connec, _)| Listener::new(connec.unwrap()))
|
||||
.and_then(move |(connec, _)| Listener::listen(connec.unwrap()))
|
||||
.and_then(|listener| {
|
||||
let proto_name = Bytes::from("invalid-proto");
|
||||
listener.send(ListenerToDialerMessage::ProtocolAck { name: proto_name })
|
||||
@ -266,7 +266,7 @@ mod tests {
|
||||
|
||||
let client = TcpStream::connect(&listener_addr)
|
||||
.from_err()
|
||||
.and_then(move |stream| Dialer::<_, Bytes>::new(stream));
|
||||
.and_then(move |stream| Dialer::<_, Bytes>::dial(stream));
|
||||
|
||||
let mut rt = Runtime::new().unwrap();
|
||||
match rt.block_on(server.join(client)) {
|
||||
|
@ -52,7 +52,7 @@ fn negotiate_with_self_succeeds() {
|
||||
.incoming()
|
||||
.into_future()
|
||||
.map_err(|(e, _)| e.into())
|
||||
.and_then(move |(connec, _)| Listener::new(connec.unwrap()))
|
||||
.and_then(move |(connec, _)| Listener::listen(connec.unwrap()))
|
||||
.and_then(|l| l.into_future().map_err(|(e, _)| e))
|
||||
.and_then(|(msg, rest)| {
|
||||
let proto = match msg {
|
||||
@ -64,7 +64,7 @@ fn negotiate_with_self_succeeds() {
|
||||
|
||||
let client = TcpStream::connect(&listener_addr)
|
||||
.from_err()
|
||||
.and_then(move |stream| Dialer::new(stream))
|
||||
.and_then(move |stream| Dialer::dial(stream))
|
||||
.and_then(move |dialer| {
|
||||
let p = b"/hello/1.0.0";
|
||||
dialer.send(DialerToListenerMessage::ProtocolRequest { name: p })
|
||||
|
Reference in New Issue
Block a user