File tree 4 files changed +60
-30
lines changed
4 files changed +60
-30
lines changed Original file line number Diff line number Diff line change @@ -1123,38 +1123,20 @@ def deconstruct_keys(_keys)
1123
1123
end
1124
1124
1125
1125
def format ( q )
1126
- parts = [ *requireds ]
1127
- parts << RestFormatter . new ( rest ) if rest
1128
- parts += posts
1129
-
1130
- if constant
1131
- q . group do
1132
- q . format ( constant )
1133
- q . text ( "[" )
1134
- q . indent do
1135
- q . breakable ( "" )
1136
- q . seplist ( parts ) { |part | q . format ( part ) }
1137
- end
1138
- q . breakable ( "" )
1139
- q . text ( "]" )
1140
- end
1141
-
1142
- return
1143
- end
1144
-
1145
- parent = q . parent
1146
- if parts . length == 1 || PATTERNS . include? ( parent . class )
1126
+ q . group do
1127
+ q . format ( constant ) if constant
1147
1128
q . text ( "[" )
1148
1129
q . indent do
1149
1130
q . breakable ( "" )
1131
+
1132
+ parts = [ *requireds ]
1133
+ parts << RestFormatter . new ( rest ) if rest
1134
+ parts += posts
1135
+
1150
1136
q . seplist ( parts ) { |part | q . format ( part ) }
1151
1137
end
1152
1138
q . breakable ( "" )
1153
1139
q . text ( "]" )
1154
- elsif parts . empty?
1155
- q . text ( "[]" )
1156
- else
1157
- q . group { q . seplist ( parts ) { |part | q . format ( part ) } }
1158
1140
end
1159
1141
end
1160
1142
end
Original file line number Diff line number Diff line change 6
6
case foo
7
7
in _, _
8
8
end
9
+ -
10
+ case foo
11
+ in [_, _]
12
+ end
9
13
%
10
14
case foo
11
15
in bar, baz
12
16
end
17
+ -
18
+ case foo
19
+ in [bar, baz]
20
+ end
13
21
%
14
22
case foo
15
23
in [bar]
16
24
end
17
25
%
18
26
case foo
19
- in [bar, baz]
27
+ in [bar]
28
+ in [baz]
20
29
end
21
- -
30
+ %
22
31
case foo
23
- in bar, baz
32
+ in [ bar, baz]
24
33
end
25
34
%
26
35
case foo
27
36
in bar, *baz
28
37
end
38
+ -
39
+ case foo
40
+ in [bar, *baz]
41
+ end
29
42
%
30
43
case foo
31
44
in *bar, baz
32
45
end
46
+ -
47
+ case foo
48
+ in [*bar, baz]
49
+ end
33
50
%
34
51
case foo
35
52
in bar, *, baz
36
53
end
54
+ -
55
+ case foo
56
+ in [bar, *, baz]
57
+ end
37
58
%
38
59
case foo
39
60
in *, bar, baz
40
61
end
62
+ -
63
+ case foo
64
+ in [*, bar, baz]
65
+ end
41
66
%
42
67
case foo
43
68
in Constant[bar]
44
69
end
45
70
%
46
71
case foo
72
+ in Constant(bar)
73
+ end
74
+ -
75
+ case foo
76
+ in Constant[bar]
77
+ end
78
+ %
79
+ case foo
47
80
in Constant[bar, baz]
48
81
end
49
82
%
50
83
case foo
51
84
in bar, [baz, _] => qux
52
85
end
86
+ -
87
+ case foo
88
+ in [bar, [baz, _] => qux]
89
+ end
53
90
%
54
91
case foo
55
92
in bar, baz if bar == baz
56
93
end
94
+ -
95
+ case foo
96
+ in [bar, baz] if bar == baz
97
+ end
Original file line number Diff line number Diff line change 71
71
in bar, { baz:, **nil }
72
72
in qux:
73
73
end
74
+ -
75
+ case foo
76
+ in [bar, { baz:, **nil }]
77
+ in qux:
78
+ end
Original file line number Diff line number Diff line change 14
14
end
15
15
-
16
16
case foo
17
- in fooooooooooooooooooooooooooooooooooooo,
18
- barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
17
+ in [
18
+ fooooooooooooooooooooooooooooooooooooo,
19
+ barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
20
+ ]
19
21
baz
20
22
end
21
23
%
You can’t perform that action at this time.
0 commit comments