]> git.lizzy.rs Git - rust.git/commitdiff
Do not panic on type ascription or try shorthand
authorMarcus Klaas <mail@marcusklaas.nl>
Tue, 29 Mar 2016 22:01:54 +0000 (00:01 +0200)
committerMarcus Klaas <mail@marcusklaas.nl>
Tue, 29 Mar 2016 22:01:54 +0000 (00:01 +0200)
Instead, simply format expressions involving these unstable features
as they were found.

src/expr.rs

index 968eac96806e16d72f194d2aa90c9389a5ee7a1c..5c4a236705fc1d4971a5eed53b382115959d9347 100644 (file)
@@ -176,9 +176,6 @@ fn rewrite(&self, context: &RewriteContext, width: usize, offset: Indent) -> Opt
             ast::ExprKind::Cast(ref expr, ref ty) => {
                 rewrite_pair(&**expr, &**ty, "", " as ", "", context, width, offset)
             }
-            // TODO(#848): Handle type ascription; rust tracking issue
-            //   https://github.com/rust-lang/rust/issues/23416
-            ast::ExprKind::Type(_, _) => unimplemented!(),
             ast::ExprKind::Index(ref expr, ref index) => {
                 rewrite_pair(&**expr, &**index, "", "[", "]", context, width, offset)
             }
@@ -211,15 +208,16 @@ fn rewrite(&self, context: &RewriteContext, width: usize, offset: Indent) -> Opt
             // We do not format these expressions yet, but they should still
             // satisfy our width restrictions.
             ast::ExprKind::InPlace(..) |
-            ast::ExprKind::InlineAsm(..) => {
+            ast::ExprKind::InlineAsm(..) |
+            // TODO(#848): Handle type ascription
+            ast::ExprKind::Type(_, _) |
+            // TODO(#867): Handle try shorthand
+            ast::ExprKind::Try(_) => {
                 wrap_str(context.snippet(self.span),
                          context.config.max_width,
                          width,
                          offset)
             }
-            // TODO(#867): Handle type ascription; rust tracking issue
-            //   https://github.com/rust-lang/rust/issues/31436
-            ast::ExprKind::Try(_) => unimplemented!(),
         };
         result.and_then(|res| recover_comment_removed(res, self.span, context, width, offset))
     }