Skip to content

Commit

Permalink
Update rustfmt for ast::ExprKind::FormatArgs.
Browse files Browse the repository at this point in the history
Rustfmt doesn't expand macros, so that's easy: FormatArgs nodes do not
occur in the unexpanded AST.
  • Loading branch information
m-ou-se committed Jan 11, 2023
1 parent 8c8aa38 commit 80d196d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ pub(crate) fn format_expr(
}
}
ast::ExprKind::Underscore => Some("_".to_owned()),
ast::ExprKind::IncludedBytes(..) => unreachable!(),
ast::ExprKind::FormatArgs(..) | ast::ExprKind::IncludedBytes(..) => {
// These do not occur in the AST because macros aren't expanded.
unreachable!()
}
ast::ExprKind::Err => None,
};

Expand Down
1 change: 1 addition & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ pub(crate) fn first_line_ends_with(s: &str, c: char) -> bool {
pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr: &str) -> bool {
match expr.kind {
ast::ExprKind::MacCall(..)
| ast::ExprKind::FormatArgs(..)
| ast::ExprKind::Call(..)
| ast::ExprKind::MethodCall(..)
| ast::ExprKind::Array(..)
Expand Down

0 comments on commit 80d196d

Please sign in to comment.