diff --git a/src/processor.rs b/src/processor.rs index 755361d44..a072f6496 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -69,7 +69,7 @@ pub async fn handle_request( let mut response = HttpResponse::build(status_code); apply_headers(&mut response, headers.clone()); - let final_response = if body != "" { + let final_response = if !body.is_empty() { response.body(body) } else { response.finish() diff --git a/src/server.rs b/src/server.rs index 26338a243..293269335 100644 --- a/src/server.rs +++ b/src/server.rs @@ -315,7 +315,7 @@ async fn index( if !req.query_string().is_empty() { let split = req.query_string().split('&'); for s in split { - let params = s.split_once("=").unwrap_or((s, "")); + let params = s.split_once('=').unwrap_or((s, "")); queries.insert(params.0.to_string(), params.1.to_string()); } } @@ -342,7 +342,7 @@ async fn index( let mut headers_dup = HashMap::new(); - if tuple_params.len() != 0 { + if !tuple_params.is_empty() { headers_dup = tuple_params.get("headers").unwrap().clone(); } diff --git a/src/web_socket_connection.rs b/src/web_socket_connection.rs index 227c838bf..b2021c765 100644 --- a/src/web_socket_connection.rs +++ b/src/web_socket_connection.rs @@ -169,7 +169,8 @@ pub async fn start_web_socket( event_loop: Arc, ) -> Result { // execute the async function here - let resp = ws::start( + + ws::start( MyWs { router, event_loop, @@ -177,6 +178,5 @@ pub async fn start_web_socket( }, &req, stream, - ); - resp + ) }