diff --git a/src/connect.rs b/src/connect.rs index dfb44de..2189eb4 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -67,7 +67,7 @@ mod encryption { } pub fn wrap_stream(socket: S, domain: String, mode: Mode) - -> Box, Error=Error> + Send> + -> Box, Error=Error> + Send> where S: 'static + AsyncRead + AsyncWrite + Send, { @@ -77,8 +77,8 @@ mod encryption { Box::new(future::result(TlsConnector::new()) .map(TokioTlsConnector::from) .and_then(move |connector| connector.connect(&domain, socket)) - .map(|s| StreamSwitcher::Tls(s)) - .map_err(|e| Error::Tls(e))) + .map(StreamSwitcher::Tls) + .map_err(Error::Tls)) } } } @@ -123,7 +123,7 @@ fn domain(request: &Request) -> Result { /// Creates a WebSocket handshake from a request and a stream, /// upgrading the stream to TLS if required. pub fn client_async_tls(request: R, stream: S) - -> Box>, Response), Error=Error> + Send> + -> Box>, Response), Error=Error> + Send> where R: Into>, S: 'static + AsyncRead + AsyncWrite + NoDelay + Send, @@ -138,7 +138,7 @@ where // Make sure we check domain and mode first. URL must be valid. let mode = match url_mode(&request.url) { Ok(m) => m, - Err(e) => return Box::new(future::err(e.into())), + Err(e) => return Box::new(future::err(e)), }; Box::new(wrap_stream(stream, domain, mode) @@ -152,7 +152,7 @@ where /// Connect to a given URL. pub fn connect_async(request: R) - -> Box>, Response), Error=Error> + Send> + -> Box>, Response), Error=Error> + Send> where R: Into> { diff --git a/src/lib.rs b/src/lib.rs index 52f1697..fb70c47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -215,7 +215,7 @@ impl Stream for WebSocketStream where T: AsyncRead + AsyncWrite { fn poll(&mut self) -> Poll, WsError> { self.inner .read_message() - .map(|msg| Some(msg)) + .map(Some) .to_async() .or_else(|err| match err { WsError::ConnectionClosed => Ok(Async::Ready(None)),