Print closed range as ... in patterns and ..= in exprs
diff --git a/src/expr.rs b/src/expr.rs
index 12e4812..523efd8 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -2653,7 +2653,10 @@
impl ToTokens for ExprRange {
fn to_tokens(&self, tokens: &mut Tokens) {
self.from.to_tokens(tokens);
- self.limits.to_tokens(tokens);
+ match self.limits {
+ RangeLimits::HalfOpen(ref t) => t.to_tokens(tokens),
+ RangeLimits::Closed(ref t) => t.to_tokens(tokens),
+ }
self.to.to_tokens(tokens);
}
}
@@ -2875,7 +2878,10 @@
impl ToTokens for PatRange {
fn to_tokens(&self, tokens: &mut Tokens) {
self.lo.to_tokens(tokens);
- self.limits.to_tokens(tokens);
+ match self.limits {
+ RangeLimits::HalfOpen(ref t) => t.to_tokens(tokens),
+ RangeLimits::Closed(ref t) => Token.to_tokens(tokens),
+ }
self.hi.to_tokens(tokens);
}
}
@@ -2916,16 +2922,6 @@
}
#[cfg(feature = "full")]
- impl ToTokens for RangeLimits {
- fn to_tokens(&self, tokens: &mut Tokens) {
- match *self {
- RangeLimits::HalfOpen(ref t) => t.to_tokens(tokens),
- RangeLimits::Closed(ref t) => t.to_tokens(tokens),
- }
- }
- }
-
- #[cfg(feature = "full")]
impl ToTokens for FieldPat {
fn to_tokens(&self, tokens: &mut Tokens) {
// XXX: Override is_shorthand if it was wrong?