Skip to content

Commit 716d1c7

Browse files
committed
Show removed exprssions and blocks as .. and { .. } instead of {}.
1 parent 1009bc8 commit 716d1c7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/unstable-api/src/util.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ pub(crate) fn lit_is_str(lit: &syn::Lit, s: &str) -> bool {
1717
pub(crate) fn empty_block() -> syn::Block {
1818
syn::Block {
1919
brace_token: Default::default(),
20-
stmts: Default::default(),
20+
stmts: vec![syn::Stmt::Expr(empty_expr())],
2121
}
2222
}
2323

2424
pub(crate) fn empty_expr() -> syn::Expr {
25-
syn::ExprBlock {
26-
attrs: vec![],
27-
label: None,
28-
block: empty_block(),
25+
// This is just a `..` token, which is technically a valid expression,
26+
// but looks like a placeholder.
27+
syn::ExprRange {
28+
attrs: Vec::new(),
29+
from: None,
30+
to: None,
31+
limits: syn::RangeLimits::HalfOpen(Default::default()),
2932
}
3033
.into()
3134
}

0 commit comments

Comments
 (0)