Skip to content

Commit 348490d

Browse files
committed
Also get rustfmt to at least compile
1 parent c8e7184 commit 348490d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/tools/rustfmt/src/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,13 @@ pub(crate) fn format_expr(
363363
// Style Guide RFC for InlineAsm variant pending
364364
// https://github.com/rust-dev-tools/fmt-rfcs/issues/152
365365
ast::ExprKind::InlineAsm(..) => Ok(context.snippet(expr.span).to_owned()),
366-
ast::ExprKind::TryBlock(ref block) => {
366+
ast::ExprKind::TryBlock(ref block, None) => {
367367
if let rw @ Ok(_) =
368368
rewrite_single_line_block(context, "try ", block, Some(&expr.attrs), None, shape)
369369
{
370370
rw
371371
} else {
372+
// FIXME: 9 sounds like `"do catch ".len()`, so may predate the rename
372373
// 9 = `try `
373374
let budget = shape.width.saturating_sub(9);
374375
Ok(format!(
@@ -384,6 +385,8 @@ pub(crate) fn format_expr(
384385
))
385386
}
386387
}
388+
// FIXME: heterogeneous try blocks, which include a type so are harder to format
389+
ast::ExprKind::TryBlock(_, Some(_)) => Err(RewriteError::Unknown),
387390
ast::ExprKind::Gen(capture_by, ref block, ref kind, _) => {
388391
let mover = if matches!(capture_by, ast::CaptureBy::Value { .. }) {
389392
"move "

0 commit comments

Comments
 (0)