Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaemon committed May 16, 2022
1 parent fbf01a8 commit d4a7e75
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/expand.rs
Expand Up @@ -10,7 +10,7 @@ use syn::visit_mut::{self, VisitMut};
use syn::{
parse_quote, parse_quote_spanned, Attribute, Block, FnArg, GenericParam, Generics, Ident,
ImplItem, Lifetime, LifetimeDef, Pat, PatIdent, Receiver, ReturnType, Signature, Stmt, Token,
TraitItem, Type, TypeParamBound, TypePath, WhereClause,
TraitItem, Type, TypeImplTrait, TypeParamBound, TypePath, WhereClause,
};

impl ToTokens for Item {
Expand Down Expand Up @@ -275,6 +275,13 @@ fn transform_sig(
}) => {}
FnArg::Receiver(arg) => arg.mutability = None,
FnArg::Typed(arg) => {
use syn::spanned::Spanned;
if let Type::ImplTrait(TypeImplTrait { ref mut bounds, .. }) = *arg.ty {
let span = bounds.span();
let lifetime = Lifetime::new("'async_trait", span);
bounds.push(TypeParamBound::Lifetime(lifetime));
}

if let Pat::Ident(ident) = &mut *arg.pat {
ident.by_ref = None;
ident.mutability = None;
Expand Down

0 comments on commit d4a7e75

Please sign in to comment.