Fix various clippy warnings

pull/5/head
Sebastian Dröge 5 years ago
parent 4a71349d38
commit c2374308b0
  1. 4
      examples/autobahn-client.rs
  2. 2
      examples/client.rs
  3. 4
      examples/echo-server.rs
  4. 2
      src/connect.rs

@ -3,7 +3,7 @@ use futures::{SinkExt, StreamExt};
use log::*; use log::*;
use url::Url; use url::Url;
const AGENT: &'static str = "Tungstenite"; const AGENT: &str = "Tungstenite";
async fn get_case_count() -> Result<u32> { async fn get_case_count() -> Result<u32> {
let (mut socket, _) = let (mut socket, _) =
@ -48,7 +48,7 @@ async fn run() {
let total = get_case_count().await.unwrap(); let total = get_case_count().await.unwrap();
for case in 1..(total + 1) { for case in 1..=total {
run_test(case).await run_test(case).await
} }

@ -38,7 +38,7 @@ async fn run() {
let (write, read) = ws_stream.split(); let (write, read) = ws_stream.split();
let stdin_to_ws = stdin_rx.map(|msg| Ok(msg)).forward(write); let stdin_to_ws = stdin_rx.map(Ok).forward(write);
let ws_to_stdout = { let ws_to_stdout = {
read.for_each(|message| { read.for_each(|message| {
async { async {

@ -17,7 +17,9 @@ use log::info;
async fn run() -> Result<(), Error> { async fn run() -> Result<(), Error> {
let _ = env_logger::try_init(); let _ = env_logger::try_init();
let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string()); let addr = env::args()
.nth(1)
.unwrap_or_else(|| "127.0.0.1:8080".to_string());
let addr = addr let addr = addr
.to_socket_addrs() .to_socket_addrs()
.await .await

@ -50,7 +50,7 @@ pub(crate) mod encryption {
Mode::Tls => { Mode::Tls => {
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
let stream = { let stream = {
let connector = connector.unwrap_or_else(|| AsyncTlsConnector::new()); let connector = connector.unwrap_or_else(AsyncTlsConnector::new);
connector.connect(&domain, socket)?.await? connector.connect(&domain, socket)?.await?
}; };
#[cfg(feature = "native-tls")] #[cfg(feature = "native-tls")]

Loading…
Cancel
Save