Skip to content

Commit

Permalink
fix named_via
Browse files Browse the repository at this point in the history
  • Loading branch information
lz1998 committed Dec 29, 2023
1 parent 843871e commit 26b415e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions axum-macros/src/from_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ fn extract_fields(
if let Some((_, path)) = via {
let span = path.span();
quote_spanned! {span=>
#path<#field_ty>
#path::<#field_ty>
}
} else {
quote_spanned! {ty_span=>
Expand Down Expand Up @@ -519,7 +519,7 @@ fn extract_fields(
};
Ok(tokens)
} else if peel_result_ok(&field.ty).is_some() {
let field_ty = into_outer(&via,ty_span,peel_result_ok(&field.ty).unwrap());
let field_ty = into_outer(&via,ty_span, peel_result_ok(&field.ty).unwrap());
let tokens = match tr {
Trait::FromRequest => {
quote_spanned! {ty_span=>
Expand Down Expand Up @@ -605,18 +605,20 @@ fn extract_fields(
let into_inner = into_inner(&via, ty_span);

let item = if peel_option(&field.ty).is_some() {
let field_ty = into_outer(&via, ty_span, peel_option(&field.ty).unwrap());
quote_spanned! {ty_span=>
#member: {
::axum::extract::FromRequest::from_request(req, state)
#field_ty::from_request(req, state)
.await
.ok()
.map(#into_inner)
},
}
} else if peel_result_ok(&field.ty).is_some() {
let field_ty = into_outer(&via, ty_span, peel_result_ok(&field.ty).unwrap());
quote_spanned! {ty_span=>
#member: {
::axum::extract::FromRequest::from_request(req, state)
#field_ty::from_request(req, state)
.await
.map(#into_inner)
},
Expand Down

0 comments on commit 26b415e

Please sign in to comment.