Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineRR committed Jul 16, 2022
1 parent 0406af9 commit 6056e6d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/executors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub async fn execute_function(
number_of_params: u8,
is_async: bool,
) -> Result<HashMap<String, String>> {
let mut request: HashMap<String, String> = HashMap::new();
let request: HashMap<String, String> = HashMap::new();

if is_async {
let output = Python::with_gil(|py| {
Expand Down
2 changes: 1 addition & 1 deletion src/request_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub async fn handle_http_request(
debug!("These are the headers from serde {:?}", headers);

let mut response = HttpResponse::build(status_code);
apply_headers(&mut response, headers.clone());
apply_headers(&mut response, headers);
let final_response = if !body.is_empty() {
response.body(body)
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/routers/const_router.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;
use std::sync::RwLock;
use std::{collections::HashMap, sync::Arc};
// pyo3 modules
use crate::{executors::execute_function, types::PyFunction};
use crate::executors::execute_function;
use log::debug;
use pyo3::prelude::*;
use pyo3::types::PyAny;
Expand Down Expand Up @@ -115,8 +115,9 @@ impl ConstRouter {
) -> Option<String> {
// need to split this function in multiple smaller functions
let table = self.get_relevant_map(route_method)?;
let route_map = table.read().ok()?;

match table.clone().read().unwrap().at(route) {
match route_map.at(route) {
Ok(res) => Some(res.value.clone()),
Err(_) => None,
}
Expand Down
3 changes: 2 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ impl Server {

/// Add a new route to the routing tables
/// can be called after the server has been started
#[allow(clippy::too_many_arguments)]
pub fn add_route(
&self,
py: Python,
Expand Down Expand Up @@ -425,7 +426,7 @@ async fn index(
}
};

let _ = match middleware_router.get_route("AFTER_REQUEST", req.uri().path()) {
match middleware_router.get_route("AFTER_REQUEST", req.uri().path()) {
Some(((handler_function, number_of_params), route_params)) => {
let x = handle_http_middleware_request(
handler_function,
Expand Down

0 comments on commit 6056e6d

Please sign in to comment.