@@ -179,28 +179,33 @@ impl Rewrite for Pat {
179
179
None
180
180
}
181
181
}
182
- PatKind :: Range ( ref lhs, ref rhs, ref end_kind) => match ( lhs, rhs) {
183
- ( Some ( lhs) , Some ( rhs) ) => {
184
- let infix = match end_kind. node {
185
- RangeEnd :: Included ( RangeSyntax :: DotDotDot ) => "..." ,
186
- RangeEnd :: Included ( RangeSyntax :: DotDotEq ) => "..=" ,
187
- RangeEnd :: Excluded => ".." ,
188
- } ;
189
- let infix = if context. config . spaces_around_ranges ( ) {
190
- format ! ( " {} " , infix)
191
- } else {
192
- infix. to_owned ( )
193
- } ;
194
- rewrite_pair (
195
- & * * lhs,
196
- & * * rhs,
197
- PairParts :: infix ( & infix) ,
198
- context,
199
- shape,
200
- SeparatorPlace :: Front ,
201
- )
202
- } ,
203
- ( _, _) => unimplemented ! ( ) ,
182
+ PatKind :: Range ( ref lhs, ref rhs, ref end_kind) => {
183
+ let infix = match end_kind. node {
184
+ RangeEnd :: Included ( RangeSyntax :: DotDotDot ) => "..." ,
185
+ RangeEnd :: Included ( RangeSyntax :: DotDotEq ) => "..=" ,
186
+ RangeEnd :: Excluded => ".." ,
187
+ } ;
188
+ let lhs_spacing = match lhs {
189
+ None => "" ,
190
+ Some ( _) => " " ,
191
+ } ;
192
+ let rhs_spacing = match rhs {
193
+ None => "" ,
194
+ Some ( _) => " " ,
195
+ } ;
196
+ let infix = if context. config . spaces_around_ranges ( ) {
197
+ format ! ( "{}{}{}" , lhs_spacing, infix, rhs_spacing)
198
+ } else {
199
+ infix. to_owned ( )
200
+ } ;
201
+ rewrite_pair (
202
+ lhs,
203
+ rhs,
204
+ PairParts :: infix ( & infix) ,
205
+ context,
206
+ shape,
207
+ SeparatorPlace :: Front ,
208
+ )
204
209
}
205
210
PatKind :: Ref ( ref pat, mutability) => {
206
211
let prefix = format ! ( "&{}" , format_mutability( mutability) ) ;
0 commit comments