File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -247,9 +247,10 @@ impl<'a> Spanned for TuplePatField<'a> {
247
247
pub fn can_be_overflowed_pat ( context : & RewriteContext , pat : & TuplePatField , len : usize ) -> bool {
248
248
match * pat {
249
249
TuplePatField :: Pat ( pat) => match pat. node {
250
- ast:: PatKind :: Path ( ..) | ast:: PatKind :: Tuple ( ..) | ast:: PatKind :: Struct ( ..) => {
251
- context. use_block_indent ( ) && len == 1
252
- }
250
+ ast:: PatKind :: Path ( ..) |
251
+ ast:: PatKind :: Tuple ( ..) |
252
+ ast:: PatKind :: Struct ( ..) |
253
+ ast:: PatKind :: TupleStruct ( ..) => context. use_block_indent ( ) && len == 1 ,
253
254
ast:: PatKind :: Ref ( ref p, _) | ast:: PatKind :: Box ( ref p) => {
254
255
can_be_overflowed_pat ( context, & TuplePatField :: Pat ( p) , len)
255
256
}
Original file line number Diff line number Diff line change @@ -48,3 +48,18 @@ fn issue_1874() {
48
48
y
49
49
}
50
50
}
51
+
52
+ fn combine_patterns ( ) {
53
+ let x = match y {
54
+ Some (
55
+ Some (
56
+ Foo {
57
+ z : Bar ( ..) ,
58
+ a : Bar ( ..) ,
59
+ b : Bar ( ..) ,
60
+ } ,
61
+ ) ,
62
+ ) => z,
63
+ _ => return ,
64
+ } ;
65
+ }
Original file line number Diff line number Diff line change @@ -63,3 +63,14 @@ fn issue_1874() {
63
63
y
64
64
}
65
65
}
66
+
67
+ fn combine_patterns ( ) {
68
+ let x = match y {
69
+ Some ( Some ( Foo {
70
+ z : Bar ( ..) ,
71
+ a : Bar ( ..) ,
72
+ b : Bar ( ..) ,
73
+ } ) ) => z,
74
+ _ => return ,
75
+ } ;
76
+ }
You can’t perform that action at this time.
0 commit comments