diff --git a/src/connect.rs b/src/connect.rs index 5a083de..2189eb4 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -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)) } } } @@ -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) 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)),