Skip to content

Commit

Permalink
don't apply formatting to builtin type ascription syntax
Browse files Browse the repository at this point in the history
The syntax changed from `expr: ty` -> `builtin # type_ascribe(expr, ty)`
For now, rustfmt will just emit the contents of the span.
  • Loading branch information
ytmimi committed May 6, 2024
1 parent 919fb28 commit 44a0dae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,6 @@ pub(crate) fn format_expr(
shape,
SeparatorPlace::Front,
),
ast::ExprKind::Type(ref expr, ref ty) => rewrite_pair(
&**expr,
&**ty,
PairParts::infix(": "),
context,
shape,
SeparatorPlace::Back,
),
ast::ExprKind::Index(ref expr, ref index, _) => {
rewrite_index(&**expr, &**index, context, shape)
}
Expand Down Expand Up @@ -402,6 +394,7 @@ pub(crate) fn format_expr(
}
ast::ExprKind::Underscore => Some("_".to_owned()),
ast::ExprKind::FormatArgs(..)
| ast::ExprKind::Type(..)
| ast::ExprKind::IncludedBytes(..)
| ast::ExprKind::OffsetOf(..) => {
// These don't normally occur in the AST because macros aren't expanded. However,
Expand Down
3 changes: 3 additions & 0 deletions tests/target/issue_6159.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
builtin # type_ascribe(10, usize)
}

0 comments on commit 44a0dae

Please sign in to comment.