File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -537,18 +537,29 @@ impl Rewrite for ast::Lifetime {
537537impl Rewrite for ast:: GenericBound {
538538 fn rewrite ( & self , context : & RewriteContext < ' _ > , shape : Shape ) -> Option < String > {
539539 match * self {
540- ast:: GenericBound :: Trait ( ref poly_trait_ref, modifiers) => {
540+ ast:: GenericBound :: Trait (
541+ ref poly_trait_ref,
542+ ast:: TraitBoundModifiers {
543+ constness,
544+ asyncness,
545+ polarity,
546+ } ,
547+ ) => {
541548 let snippet = context. snippet ( self . span ( ) ) ;
542549 let has_paren = snippet. starts_with ( '(' ) && snippet. ends_with ( ')' ) ;
543- let mut constness = modifiers . constness . as_str ( ) . to_string ( ) ;
550+ let mut constness = constness. as_str ( ) . to_string ( ) ;
544551 if !constness. is_empty ( ) {
545552 constness. push ( ' ' ) ;
546553 }
547- let polarity = modifiers. polarity . as_str ( ) ;
554+ let mut asyncness = asyncness. as_str ( ) . to_string ( ) ;
555+ if !asyncness. is_empty ( ) {
556+ asyncness. push ( ' ' ) ;
557+ }
558+ let polarity = polarity. as_str ( ) ;
548559 let shape = shape. offset_left ( constness. len ( ) + polarity. len ( ) ) ?;
549560 poly_trait_ref
550561 . rewrite ( context, shape)
551- . map ( |s| format ! ( "{constness}{polarity}{s}" ) )
562+ . map ( |s| format ! ( "{constness}{asyncness}{ polarity}{s}" ) )
552563 . map ( |s| if has_paren { format ! ( "({})" , s) } else { s } )
553564 }
554565 ast:: GenericBound :: Outlives ( ref lifetime) => lifetime. rewrite ( context, shape) ,
Original file line number Diff line number Diff line change 1+ // rustfmt-edition: 2018
2+
3+ fn foo ( ) -> impl async Fn ( ) { }
You can’t perform that action at this time.
0 commit comments