diff --git a/worker/src/websocket.rs b/worker/src/websocket.rs index d0a8e654..96ea7ed6 100644 --- a/worker/src/websocket.rs +++ b/worker/src/websocket.rs @@ -64,7 +64,7 @@ impl WebSocket { /// Response::error("never got a message echoed back :(", 500) /// ``` pub async fn connect(url: Url) -> Result { - return WebSocket::connect_with_protocols(url, None).await; + WebSocket::connect_with_protocols(url, None).await } /// Attempts to establish a [`WebSocket`] connection to the provided [`Url`] and protocol. @@ -74,7 +74,10 @@ impl WebSocket { /// let ws = WebSocket::connect_with_protocols("wss://echo.zeb.workers.dev/".parse()?, Some(vec!["GiggleBytes"])).await?; /// /// ``` - pub async fn connect_with_protocols(mut url: Url, protocols: Option>) -> Result { + pub async fn connect_with_protocols( + mut url: Url, + protocols: Option>, + ) -> Result { let scheme: String = match url.scheme() { "ws" => "http".into(), "wss" => "https".into(), @@ -91,7 +94,8 @@ impl WebSocket { match protocols { None => {} Some(v) => { - req.headers_mut()?.set("Sec-WebSocket-Protocol", v.join(",").as_str())?; + req.headers_mut()? + .set("Sec-WebSocket-Protocol", v.join(",").as_str())?; } }