File tree 3 files changed +43
-1
lines changed
3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,11 @@ fn flatten_arm_body<'a>(
322
322
if let Some ( block) = block_can_be_flattened ( context, body) {
323
323
if let ast:: StmtKind :: Expr ( ref expr) = block. stmts [ 0 ] . kind {
324
324
if let ast:: ExprKind :: Block ( ..) = expr. kind {
325
- flatten_arm_body ( context, expr, None )
325
+ if expr. attrs . is_empty ( ) {
326
+ flatten_arm_body ( context, expr, None )
327
+ } else {
328
+ ( true , body)
329
+ }
326
330
} else {
327
331
let cond_becomes_muti_line = opt_shape
328
332
. and_then ( |shape| rewrite_cond ( context, expr, shape) )
Original file line number Diff line number Diff line change @@ -568,3 +568,22 @@ fn issue_3774() {
568
568
}
569
569
}
570
570
}
571
+
572
+ // #4109
573
+ fn issue_4109 ( ) {
574
+ match ( ) {
575
+ _ => {
576
+ #[ cfg( debug_assertions) ]
577
+ {
578
+ println ! ( "Foo" ) ;
579
+ }
580
+ }
581
+ }
582
+
583
+ match ( ) {
584
+ _ => {
585
+ #[ allow( unsafe_code) ]
586
+ unsafe { }
587
+ }
588
+ }
589
+ }
Original file line number Diff line number Diff line change @@ -608,3 +608,22 @@ fn issue_3774() {
608
608
}
609
609
}
610
610
}
611
+
612
+ // #4109
613
+ fn issue_4109 ( ) {
614
+ match ( ) {
615
+ _ => {
616
+ #[ cfg( debug_assertions) ]
617
+ {
618
+ println ! ( "Foo" ) ;
619
+ }
620
+ }
621
+ }
622
+
623
+ match ( ) {
624
+ _ => {
625
+ #[ allow( unsafe_code) ]
626
+ unsafe { }
627
+ }
628
+ }
629
+ }
You can’t perform that action at this time.
0 commit comments