File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,11 @@ fn flatten_arm_body<'a>(
299
299
if let Some ( ref block) = block_can_be_flattened ( context, body) {
300
300
if let ast:: StmtKind :: Expr ( ref expr) = block. stmts [ 0 ] . kind {
301
301
if let ast:: ExprKind :: Block ( ..) = expr. kind {
302
- flatten_arm_body ( context, expr, None )
302
+ if expr. attrs . is_empty ( ) {
303
+ flatten_arm_body ( context, expr, None )
304
+ } else {
305
+ ( true , body)
306
+ }
303
307
} else {
304
308
let cond_becomes_muti_line = opt_shape
305
309
. 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 @@ -605,3 +605,22 @@ fn issue_3774() {
605
605
}
606
606
}
607
607
}
608
+
609
+ // #4109
610
+ fn issue_4109 ( ) {
611
+ match ( ) {
612
+ _ => {
613
+ #[ cfg( debug_assertions) ]
614
+ {
615
+ println ! ( "Foo" ) ;
616
+ }
617
+ }
618
+ }
619
+
620
+ match ( ) {
621
+ _ => {
622
+ #[ allow( unsafe_code) ]
623
+ unsafe { }
624
+ }
625
+ }
626
+ }
You can’t perform that action at this time.
0 commit comments