@@ -278,6 +278,7 @@ fn block_can_be_flattened<'a>(
278
278
match expr. node {
279
279
ast:: ExprKind :: Block ( ref block, _)
280
280
if !is_unsafe_block ( block)
281
+ && !context. inside_macro ( )
281
282
&& is_simple_block ( block, Some ( & expr. attrs ) , context. source_map ) =>
282
283
{
283
284
Some ( & * block)
@@ -394,25 +395,26 @@ fn rewrite_match_body(
394
395
}
395
396
396
397
let indent_str = shape. indent . to_string_with_newline ( context. config ) ;
397
- let ( body_prefix, body_suffix) = if context. config . match_arm_blocks ( ) {
398
- let comma = if context. config . match_block_trailing_comma ( ) {
399
- ","
400
- } else {
401
- ""
402
- } ;
403
- let semicolon = if context. config . version ( ) == Version :: One {
404
- ""
405
- } else {
406
- if semicolon_for_expr ( context, body) {
407
- ";"
398
+ let ( body_prefix, body_suffix) =
399
+ if context. config . match_arm_blocks ( ) && !context. inside_macro ( ) {
400
+ let comma = if context. config . match_block_trailing_comma ( ) {
401
+ ","
408
402
} else {
409
403
""
410
- }
404
+ } ;
405
+ let semicolon = if context. config . version ( ) == Version :: One {
406
+ ""
407
+ } else {
408
+ if semicolon_for_expr ( context, body) {
409
+ ";"
410
+ } else {
411
+ ""
412
+ }
413
+ } ;
414
+ ( "{" , format ! ( "{}{}}}{}" , semicolon, indent_str, comma) )
415
+ } else {
416
+ ( "" , String :: from ( "," ) )
411
417
} ;
412
- ( "{" , format ! ( "{}{}}}{}" , semicolon, indent_str, comma) )
413
- } else {
414
- ( "" , String :: from ( "," ) )
415
- } ;
416
418
417
419
let block_sep = match context. config . control_brace_style ( ) {
418
420
ControlBraceStyle :: AlwaysNextLine => format ! ( "{}{}" , alt_block_sep, body_prefix) ,
@@ -468,7 +470,9 @@ fn rewrite_match_body(
468
470
next_line_body_shape. width ,
469
471
) ;
470
472
match ( orig_body, next_line_body) {
471
- ( Some ( ref orig_str) , Some ( ref next_line_str) ) if orig_str == next_line_str => {
473
+ ( Some ( ref orig_str) , Some ( ref next_line_str) )
474
+ if orig_str == next_line_str || context. inside_macro ( ) =>
475
+ {
472
476
combine_orig_body ( orig_str)
473
477
}
474
478
( Some ( ref orig_str) , Some ( ref next_line_str) )
0 commit comments