Fix some rustc/clippy warnings. (#895)

This commit is contained in:
Toralf Wittner
2019-01-30 15:41:54 +01:00
committed by GitHub
parent a77da73010
commit e23b2733e2
25 changed files with 63 additions and 60 deletions

View File

@ -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 }
}
}

View File

@ -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;

View File

@ -55,8 +55,8 @@ where
{
ListenerSelectFuture {
inner: ListenerSelectState::AwaitListener {
listener_fut: Listener::new(inner),
protocols: protocols
listener_fut: Listener::listen(inner),
protocols
}
}
}

View File

@ -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 })

View File

@ -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)) {

View File

@ -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 })