From c2374308b0265c13d5dcf42a20b0cd0ce3a69c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 28 Dec 2019 13:02:32 +0200 Subject: [PATCH] Fix various clippy warnings --- examples/autobahn-client.rs | 4 ++-- examples/client.rs | 2 +- examples/echo-server.rs | 4 +++- src/connect.rs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/autobahn-client.rs b/examples/autobahn-client.rs index 37f2941..dea802c 100644 --- a/examples/autobahn-client.rs +++ b/examples/autobahn-client.rs @@ -3,7 +3,7 @@ use futures::{SinkExt, StreamExt}; use log::*; use url::Url; -const AGENT: &'static str = "Tungstenite"; +const AGENT: &str = "Tungstenite"; async fn get_case_count() -> Result { let (mut socket, _) = @@ -48,7 +48,7 @@ async fn run() { let total = get_case_count().await.unwrap(); - for case in 1..(total + 1) { + for case in 1..=total { run_test(case).await } diff --git a/examples/client.rs b/examples/client.rs index 0ee800c..c8dec0d 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -38,7 +38,7 @@ async fn run() { 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 = { read.for_each(|message| { async { diff --git a/examples/echo-server.rs b/examples/echo-server.rs index 43af835..ad1f09e 100644 --- a/examples/echo-server.rs +++ b/examples/echo-server.rs @@ -17,7 +17,9 @@ use log::info; async fn run() -> Result<(), Error> { 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 .to_socket_addrs() .await diff --git a/src/connect.rs b/src/connect.rs index 50cd33b..b83d4e7 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -50,7 +50,7 @@ pub(crate) mod encryption { Mode::Tls => { #[cfg(feature = "tls")] let stream = { - let connector = connector.unwrap_or_else(|| AsyncTlsConnector::new()); + let connector = connector.unwrap_or_else(AsyncTlsConnector::new); connector.connect(&domain, socket)?.await? }; #[cfg(feature = "native-tls")]