File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2993,6 +2993,8 @@ pub(crate) mod printing {
2993
2993
use crate :: path;
2994
2994
#[ cfg( feature = "full" ) ]
2995
2995
use crate :: token;
2996
+ #[ cfg( feature = "full" ) ]
2997
+ use crate :: ty:: ReturnType ;
2996
2998
use proc_macro2:: { Literal , Span , TokenStream } ;
2997
2999
use quote:: { ToTokens , TokenStreamExt } ;
2998
3000
@@ -3135,7 +3137,13 @@ pub(crate) mod printing {
3135
3137
self . inputs . to_tokens ( tokens) ;
3136
3138
self . or2_token . to_tokens ( tokens) ;
3137
3139
self . output . to_tokens ( tokens) ;
3138
- self . body . to_tokens ( tokens) ;
3140
+ if matches ! ( self . output, ReturnType :: Default ) || matches ! ( * self . body, Expr :: Block ( _) ) {
3141
+ self . body . to_tokens ( tokens) ;
3142
+ } else {
3143
+ token:: Brace :: default ( ) . surround ( tokens, |tokens| {
3144
+ self . body . to_tokens ( tokens) ;
3145
+ } ) ;
3146
+ }
3139
3147
}
3140
3148
}
3141
3149
You can’t perform that action at this time.
0 commit comments