Do not panic on type ascription or try shorthand
Instead, simply format expressions involving these unstable features as they were found.
This commit is contained in:
parent
9eee93306a
commit
f941646118
12
src/expr.rs
12
src/expr.rs
@ -176,9 +176,6 @@ impl Rewrite for ast::Expr {
|
||||
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 @@ impl Rewrite for ast::Expr {
|
||||
// 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))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user