about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorZach Lute <zach.lute@gmail.com>2018-08-25 21:02:24 -0700
committerSeiichi Uchida <seuchida@gmail.com>2018-08-26 13:02:24 +0900
commitca19c9a35a22d04d9911c95e6e8619082cc45f1b (patch)
tree081ded3e0fac8227c4c9e62044e6e6bff37b0cc7 /src
parent10512a59d00cd5b1f134d78a7ff4e2ce5abb9b12 (diff)
Fix build with rust nightly by updating try block syntax. (#2965)
Diffstat (limited to 'src')
-rw-r--r--src/closures.rs2
-rw-r--r--src/expr.rs17
2 files changed, 7 insertions, 12 deletions
diff --git a/src/closures.rs b/src/closures.rs
index f6a3d8436f2..3451fcfe6f4 100644
--- a/src/closures.rs
+++ b/src/closures.rs
@@ -173,7 +173,7 @@ fn rewrite_closure_expr(
         match expr.node {
             ast::ExprKind::Match(..)
             | ast::ExprKind::Block(..)
-            | ast::ExprKind::Catch(..)
+            | ast::ExprKind::TryBlock(..)
             | ast::ExprKind::Loop(..)
             | ast::ExprKind::Struct(..) => true,
 
diff --git a/src/expr.rs b/src/expr.rs
index e6161c0c42b..fdea683df0a 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -317,22 +317,17 @@ pub fn format_expr(
         // We do not format these expressions yet, but they should still
         // satisfy our width restrictions.
         ast::ExprKind::InlineAsm(..) => Some(context.snippet(expr.span).to_owned()),
-        ast::ExprKind::Catch(ref block) => {
-            if let rw @ Some(_) = rewrite_single_line_block(
-                context,
-                "do catch ",
-                block,
-                Some(&expr.attrs),
-                None,
-                shape,
-            ) {
+        ast::ExprKind::TryBlock(ref block) => {
+            if let rw @ Some(_) =
+                rewrite_single_line_block(context, "try ", block, Some(&expr.attrs), None, shape)
+            {
                 rw
             } else {
-                // 9 = `do catch `
+                // 9 = `try `
                 let budget = shape.width.saturating_sub(9);
                 Some(format!(
                     "{}{}",
-                    "do catch ",
+                    "try ",
                     rewrite_block(
                         block,
                         Some(&expr.attrs),