From 1170f4e080ba97a48bae285b07d5f022e5b1292d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 13 Feb 2021 16:11:45 +0200 Subject: [PATCH] Fix a couple of clippy warnings --- examples/async-std-echo.rs | 5 +---- examples/gio-echo.rs | 5 +---- examples/tokio-echo.rs | 5 +---- src/lib.rs | 4 +++- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/examples/async-std-echo.rs b/examples/async-std-echo.rs index e08e5cb..99502ca 100644 --- a/examples/async-std-echo.rs +++ b/examples/async-std-echo.rs @@ -16,10 +16,7 @@ async fn run() -> Result<(), Box> { println!("Sending: \"{}\"", text); ws_stream.send(Message::text(text)).await?; - let msg = ws_stream - .next() - .await - .ok_or_else(|| "didn't receive anything")??; + let msg = ws_stream.next().await.ok_or("didn't receive anything")??; println!("Received: {:?}", msg); diff --git a/examples/gio-echo.rs b/examples/gio-echo.rs index bcc5399..b5c0370 100644 --- a/examples/gio-echo.rs +++ b/examples/gio-echo.rs @@ -11,10 +11,7 @@ async fn run() -> Result<(), Box> { println!("Sending: \"{}\"", text); ws_stream.send(Message::text(text)).await?; - let msg = ws_stream - .next() - .await - .ok_or_else(|| "didn't receive anything")??; + let msg = ws_stream.next().await.ok_or("didn't receive anything")??; println!("Received: {:?}", msg); diff --git a/examples/tokio-echo.rs b/examples/tokio-echo.rs index d4ed890..ee27c94 100644 --- a/examples/tokio-echo.rs +++ b/examples/tokio-echo.rs @@ -22,10 +22,7 @@ async fn run() -> Result<(), Box> { println!("Sending: \"{}\"", text); ws_stream.send(Message::text(text)).await?; - let msg = ws_stream - .next() - .await - .ok_or_else(|| "didn't receive anything")??; + let msg = ws_stream.next().await.ok_or("didn't receive anything")??; println!("Received: {:?}", msg); diff --git a/src/lib.rs b/src/lib.rs index 8501978..85e86c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -394,5 +394,7 @@ pub(crate) fn port( Some("ws") => Some(80), _ => None, }) - .ok_or_else(|| tungstenite::Error::Url(tungstenite::error::UrlError::UnsupportedUrlScheme)) + .ok_or(tungstenite::Error::Url( + tungstenite::error::UrlError::UnsupportedUrlScheme, + )) }