Apply a couple trivial clippy suggestions

pull/7/head
Ran Benita 8 years ago
parent 8955b55e62
commit ae30b8cd76
  1. 2
      src/client.rs
  2. 9
      src/protocol/mod.rs

@ -57,7 +57,7 @@ fn wrap_stream(stream: TcpStream, domain: &str, mode: Mode) -> Result<AutoStream
TlsHandshakeError::Failure(f) => f.into(),
TlsHandshakeError::Interrupted(_) => panic!("Bug: TLS handshake not blocked"),
})
.map(|s| StreamSwitcher::Tls(s))
.map(StreamSwitcher::Tls)
}
}
}

@ -124,15 +124,12 @@ impl<Stream: Read + Write> WebSocket<Stream> {
/// This function guarantees that the close frame will be queued.
/// There is no need to call it again, just like write_message().
pub fn close(&mut self) -> Result<()> {
match self.state {
WebSocketState::Active => {
if let WebSocketState::Active = self.state {
self.state = WebSocketState::ClosedByUs;
let frame = Frame::close(None);
self.send_queue.push_back(frame);
}
_ => {
// already closed, nothing to do
}
} else {
// Already closed, nothing to do.
}
self.write_pending()
}

Loading…
Cancel
Save