Skip to content

Commit 80d196d

Browse files
committed
Update rustfmt for ast::ExprKind::FormatArgs.
Rustfmt doesn't expand macros, so that's easy: FormatArgs nodes do not occur in the unexpanded AST.
1 parent 8c8aa38 commit 80d196d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,10 @@ pub(crate) fn format_expr(
399399
}
400400
}
401401
ast::ExprKind::Underscore => Some("_".to_owned()),
402-
ast::ExprKind::IncludedBytes(..) => unreachable!(),
402+
ast::ExprKind::FormatArgs(..) | ast::ExprKind::IncludedBytes(..) => {
403+
// These do not occur in the AST because macros aren't expanded.
404+
unreachable!()
405+
}
403406
ast::ExprKind::Err => None,
404407
};
405408

src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ pub(crate) fn first_line_ends_with(s: &str, c: char) -> bool {
462462
pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr: &str) -> bool {
463463
match expr.kind {
464464
ast::ExprKind::MacCall(..)
465+
| ast::ExprKind::FormatArgs(..)
465466
| ast::ExprKind::Call(..)
466467
| ast::ExprKind::MethodCall(..)
467468
| ast::ExprKind::Array(..)

0 commit comments

Comments
 (0)