@@ -229,12 +229,12 @@ fn transform_sig(
229
229
. push ( parse_quote_spanned ! ( default_span=> ' async_trait) ) ;
230
230
231
231
if has_self {
232
- let bound = match sig. inputs . iter ( ) . next ( ) {
232
+ let bounds = match sig. inputs . iter ( ) . next ( ) {
233
233
Some ( FnArg :: Receiver ( Receiver {
234
234
reference : Some ( _) ,
235
235
mutability : None ,
236
236
..
237
- } ) ) => InferredBound :: Sync ,
237
+ } ) ) => [ InferredBound :: Sync ] ,
238
238
Some ( FnArg :: Typed ( arg) )
239
239
if match ( arg. pat . as_ref ( ) , arg. ty . as_ref ( ) ) {
240
240
( Pat :: Ident ( pat) , Type :: Reference ( ty) ) => {
@@ -243,23 +243,30 @@ fn transform_sig(
243
243
_ => false ,
244
244
} =>
245
245
{
246
- InferredBound :: Sync
246
+ [ InferredBound :: Sync ]
247
247
}
248
- _ => InferredBound :: Send ,
248
+ _ => [ InferredBound :: Send ] ,
249
249
} ;
250
250
251
- let assume_bound = match context {
252
- Context :: Trait { supertraits, .. } => !has_default || has_bound ( supertraits, & bound) ,
253
- Context :: Impl { .. } => true ,
254
- } ;
255
-
256
- let where_clause = where_clause_or_default ( & mut sig. generics . where_clause ) ;
257
- where_clause. predicates . push ( if assume_bound || is_local {
258
- parse_quote_spanned ! ( default_span=> Self : ' async_trait)
259
- } else {
260
- let bound = bound. spanned_path ( default_span) ;
261
- parse_quote_spanned ! ( default_span=> Self : #bound + ' async_trait)
251
+ let bounds = bounds. iter ( ) . filter_map ( |bound| {
252
+ let assume_bound = match context {
253
+ Context :: Trait { supertraits, .. } => {
254
+ !has_default || has_bound ( supertraits, bound)
255
+ }
256
+ Context :: Impl { .. } => true ,
257
+ } ;
258
+ if assume_bound || is_local {
259
+ None
260
+ } else {
261
+ Some ( bound. spanned_path ( default_span) )
262
+ }
262
263
} ) ;
264
+
265
+ where_clause_or_default ( & mut sig. generics . where_clause )
266
+ . predicates
267
+ . push ( parse_quote_spanned ! { default_span=>
268
+ Self : #( #bounds +) * ' async_trait
269
+ } ) ;
263
270
}
264
271
265
272
for ( i, arg) in sig. inputs . iter_mut ( ) . enumerate ( ) {
0 commit comments