Skip to content

Commit

Permalink
Fix endpoint parse param mut pdata warning and not working
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Dec 1, 2023
1 parent 379d5b2 commit b015cd0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/oapi-macros/src/endpoint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ fn handle_fn(salvo: &Ident, oapi: &Ident, sig: &Signature) -> syn::Result<(Token
let id = &pat.pat;
let ty = omit_type_path_lifetimes(ty);
let idv = id.to_token_stream().to_string();
// If id like `mut pdata`, then idv is `pdata`;
let idv = idv.rsplit_once(' ').map(|(_, v)| v.to_owned()).unwrap_or(idv);
let id = Ident::new(&idv, Span::call_site());
let idv = idv.trim_start_matches('_');
extract_ts.push(quote! {
let #id: #ty = match <#ty as #salvo::Extractible>::extract_with_arg(__macro_generated_req, #idv).await {
Expand Down

0 comments on commit b015cd0

Please sign in to comment.