Skip to content

Commit 41778bd

Browse files
committed
don't apply formatting to builtin type ascription syntax
The syntax changed from `expr: ty` -> `builtin # type_acribe`. For now, rustfmt will just emit the contents of the span.
1 parent 919fb28 commit 41778bd

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/expr.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,6 @@ pub(crate) fn format_expr(
253253
shape,
254254
SeparatorPlace::Front,
255255
),
256-
ast::ExprKind::Type(ref expr, ref ty) => rewrite_pair(
257-
&**expr,
258-
&**ty,
259-
PairParts::infix(": "),
260-
context,
261-
shape,
262-
SeparatorPlace::Back,
263-
),
264256
ast::ExprKind::Index(ref expr, ref index, _) => {
265257
rewrite_index(&**expr, &**index, context, shape)
266258
}
@@ -402,6 +394,7 @@ pub(crate) fn format_expr(
402394
}
403395
ast::ExprKind::Underscore => Some("_".to_owned()),
404396
ast::ExprKind::FormatArgs(..)
397+
| ast::ExprKind::Type(..)
405398
| ast::ExprKind::IncludedBytes(..)
406399
| ast::ExprKind::OffsetOf(..) => {
407400
// These don't normally occur in the AST because macros aren't expanded. However,

tests/target/issue_6159.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
builtin # type_ascribe(10, usize)
3+
}

0 commit comments

Comments
 (0)