Skip to content

Commit f941646

Browse files
committed
Do not panic on type ascription or try shorthand
Instead, simply format expressions involving these unstable features as they were found.
1 parent 9eee933 commit f941646

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/expr.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ impl Rewrite for ast::Expr {
176176
ast::ExprKind::Cast(ref expr, ref ty) => {
177177
rewrite_pair(&**expr, &**ty, "", " as ", "", context, width, offset)
178178
}
179-
// TODO(#848): Handle type ascription; rust tracking issue
180-
// https://github.com/rust-lang/rust/issues/23416
181-
ast::ExprKind::Type(_, _) => unimplemented!(),
182179
ast::ExprKind::Index(ref expr, ref index) => {
183180
rewrite_pair(&**expr, &**index, "", "[", "]", context, width, offset)
184181
}
@@ -211,15 +208,16 @@ impl Rewrite for ast::Expr {
211208
// We do not format these expressions yet, but they should still
212209
// satisfy our width restrictions.
213210
ast::ExprKind::InPlace(..) |
214-
ast::ExprKind::InlineAsm(..) => {
211+
ast::ExprKind::InlineAsm(..) |
212+
// TODO(#848): Handle type ascription
213+
ast::ExprKind::Type(_, _) |
214+
// TODO(#867): Handle try shorthand
215+
ast::ExprKind::Try(_) => {
215216
wrap_str(context.snippet(self.span),
216217
context.config.max_width,
217218
width,
218219
offset)
219220
}
220-
// TODO(#867): Handle type ascription; rust tracking issue
221-
// https://github.com/rust-lang/rust/issues/31436
222-
ast::ExprKind::Try(_) => unimplemented!(),
223221
};
224222
result.and_then(|res| recover_comment_removed(res, self.span, context, width, offset))
225223
}

0 commit comments

Comments
 (0)