Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Mar 26, 2022
1 parent 07a44db commit 89b4423
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand All @@ -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();
}

Expand Down
6 changes: 3 additions & 3 deletions src/web_socket_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ pub async fn start_web_socket(
event_loop: Arc<PyObject>,
) -> Result<HttpResponse, Error> {
// execute the async function here
let resp = ws::start(

ws::start(
MyWs {
router,
event_loop,
id: Uuid::new_v4(),
},
&req,
stream,
);
resp
)
}

0 comments on commit 89b4423

Please sign in to comment.