Skip to content

Commit

Permalink
Try to fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
axelfaure committed Sep 7, 2024
1 parent f9d591a commit 9be18a6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/web/qs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<T> QsQuery<T> {
}

impl<T: DeserializeOwned> QsQuery<T> {
pub fn from_query(query_str: &str) -> Result<Self, QueryPayloadError> {
pub fn from_(query_str: &str) -> Result<Self, QueryPayloadError> {
serde_urlencoded::from_str::<T>(query_str)
.map(Self)
.map_err(QueryPayloadError::Deserialize)
Expand All @@ -41,10 +41,10 @@ where
#[inline]
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future {
let req_copy = req.clone();
let qs_query_config = req.app_data::<QsQueryConfig>();
let error_handler = qs_query_config.and_then(|c| c.err_handler.clone());
let qs__config = req.app_data::<QsQueryConfig>();
let error_handler = qs__config.and_then(|c| c.err_handler.clone());
let default_qs_config = Config::default();
let qs_config = qs_query_config
let qs_config = qs__config
.map(|config| &config.qs_config)
.unwrap_or(&default_qs_config);

Expand Down Expand Up @@ -206,24 +206,24 @@ mod test {
Ok(())
}

async fn test_handler(_query: QsQuery<QueryData>) -> HttpResponse {
async fn test_handler(_: QsQuery<QueryData>) -> HttpResponse {
HttpResponse::Ok().finish()
}

async fn test_form_handler(_query: Form<FormData>) -> HttpResponse {
async fn test_form_handler(_: Form<FormData>) -> HttpResponse {
HttpResponse::Ok().finish()
}

async fn test_handler_with_context(_query: QsQuery<QueryDataWithContext>) -> HttpResponse {
async fn test_handler_with_context(_: QsQuery<QueryDataWithContext>) -> HttpResponse {
HttpResponse::Ok().finish()
}

async fn test_form_handler_with_context(_query: Form<FormDataWithContext>) -> HttpResponse {
async fn test_form_handler_with_context(_: Form<FormDataWithContext>) -> HttpResponse {
HttpResponse::Ok().finish()
}

#[tokio::test]
async fn test_simple_query_validation() {
async fn test_simple__validation() {
let app = init_service(App::new().service(resource("/").route(post().to(test_handler)))).await;

let req = TestRequest::post().uri("/?age=24").to_request();
Expand All @@ -236,7 +236,7 @@ mod test {
}

#[tokio::test]
async fn test_query_validation_custom_config() {
async fn test__validation_custom_config() {
let app = init_service(
App::new()
.app_data(
Expand All @@ -257,7 +257,7 @@ mod test {
}

#[tokio::test]
async fn test_query_validation_with_context() {
async fn test__validation_with_context() {
let number_context = NumberContext { min: 25 };
let app = init_service(
App::new()
Expand All @@ -276,7 +276,7 @@ mod test {
}

#[tokio::test]
async fn test_query_validation_with_missing_context() {
async fn test__validation_with_missing_context() {
let app = init_service(App::new().service(resource("/").route(post().to(test_handler_with_context)))).await;

let req = TestRequest::post().uri("/?age=24").to_request();
Expand Down

0 comments on commit 9be18a6

Please sign in to comment.