Fix some clippy warnings about unnecessary closures for more concise code

pull/1/head
Naja Melan 5 years ago
parent 0793764dcd
commit 380f531d86
  1. 6
      src/connect.rs
  2. 2
      src/lib.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)

@ -215,7 +215,7 @@ impl<T> Stream for WebSocketStream<T> where T: AsyncRead + AsyncWrite {
fn poll(&mut self) -> Poll<Option<Message>, WsError> {
self.inner
.read_message()
.map(|msg| Some(msg))
.map(Some)
.to_async()
.or_else(|err| match err {
WsError::ConnectionClosed => Ok(Async::Ready(None)),

Loading…
Cancel
Save