@@ -278,6 +278,7 @@ fn block_can_be_flattened<'a>(
278278 match expr. node {
279279 ast:: ExprKind :: Block ( ref block, _)
280280 if !is_unsafe_block ( block)
281+ && !context. inside_macro ( )
281282 && is_simple_block ( block, Some ( & expr. attrs ) , context. source_map ) =>
282283 {
283284 Some ( & * block)
@@ -394,25 +395,26 @@ fn rewrite_match_body(
394395 }
395396
396397 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+ ","
408402 } else {
409403 ""
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 ( "," ) )
411417 } ;
412- ( "{" , format ! ( "{}{}}}{}" , semicolon, indent_str, comma) )
413- } else {
414- ( "" , String :: from ( "," ) )
415- } ;
416418
417419 let block_sep = match context. config . control_brace_style ( ) {
418420 ControlBraceStyle :: AlwaysNextLine => format ! ( "{}{}" , alt_block_sep, body_prefix) ,
@@ -468,7 +470,9 @@ fn rewrite_match_body(
468470 next_line_body_shape. width ,
469471 ) ;
470472 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+ {
472476 combine_orig_body ( orig_str)
473477 }
474478 ( Some ( ref orig_str) , Some ( ref next_line_str) )
0 commit comments