|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd}; |
| 11 | +use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd, RangeSyntax}; |
12 | 12 | use syntax::codemap::{self, BytePos, Span}; |
13 | 13 | use syntax::ptr; |
14 | 14 |
|
@@ -58,31 +58,23 @@ impl Rewrite for Pat { |
58 | 58 | } else { |
59 | 59 | None |
60 | 60 | }, |
61 | | - PatKind::Range(ref lhs, ref rhs, ref end_kind) => match *end_kind { |
62 | | - RangeEnd::Excluded => rewrite_pair( |
63 | | - &**lhs, |
64 | | - &**rhs, |
65 | | - "", |
66 | | - "..", |
67 | | - "", |
68 | | - context, |
69 | | - shape, |
70 | | - SeparatorPlace::Front, |
71 | | - ), |
72 | | - // FIXME: Change _ to RangeEnd::Included(RangeSyntax::DotDotDot) |
73 | | - // and add RangeEnd::Included(RangeSyntax::DotDotEq) |
74 | | - // once rust PR #44709 gets merged |
75 | | - _ => rewrite_pair( |
| 61 | + PatKind::Range(ref lhs, ref rhs, ref end_kind) => { |
| 62 | + let infix = match *end_kind { |
| 63 | + RangeEnd::Included(RangeSyntax::DotDotDot) => "...", |
| 64 | + RangeEnd::Included(RangeSyntax::DotDotEq) => "..=", |
| 65 | + RangeEnd::Excluded => "..", |
| 66 | + }; |
| 67 | + rewrite_pair( |
76 | 68 | &**lhs, |
77 | 69 | &**rhs, |
78 | 70 | "", |
79 | | - "...", |
| 71 | + infix, |
80 | 72 | "", |
81 | 73 | context, |
82 | 74 | shape, |
83 | 75 | SeparatorPlace::Front, |
84 | | - ), |
85 | | - }, |
| 76 | + ) |
| 77 | + } |
86 | 78 | PatKind::Ref(ref pat, mutability) => { |
87 | 79 | let prefix = format!("&{}", format_mutability(mutability)); |
88 | 80 | rewrite_unary_prefix(context, &prefix, &**pat, shape) |
|
0 commit comments