Remove box_syntax
from AST and use in tools
This commit is contained in:
parent
a5ba6e025f
commit
4e658cc01e
@ -195,7 +195,6 @@ fn allow_multi_line(expr: &ast::Expr) -> bool {
|
||||
| ast::ExprKind::Struct(..) => true,
|
||||
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _) => allow_multi_line(expr),
|
||||
@ -441,7 +440,6 @@ fn is_block_closure_forced_inner(expr: &ast::Expr, version: Version) -> bool {
|
||||
ast::ExprKind::If(..) | ast::ExprKind::While(..) | ast::ExprKind::ForLoop(..) => true,
|
||||
ast::ExprKind::Loop(..) if version == Version::Two => true,
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _) => is_block_closure_forced_inner(expr, version),
|
||||
|
@ -236,7 +236,6 @@ pub(crate) fn format_expr(
|
||||
ast::ExprKind::Yeet(Some(ref expr)) => {
|
||||
rewrite_unary_prefix(context, "do yeet ", &**expr, shape)
|
||||
}
|
||||
ast::ExprKind::Box(ref expr) => rewrite_unary_prefix(context, "box ", &**expr, shape),
|
||||
ast::ExprKind::AddrOf(borrow_kind, mutability, ref expr) => {
|
||||
rewrite_expr_addrof(context, borrow_kind, mutability, expr, shape)
|
||||
}
|
||||
@ -1299,7 +1298,6 @@ pub(crate) fn is_simple_expr(expr: &ast::Expr) -> bool {
|
||||
ast::ExprKind::Lit(..) => true,
|
||||
ast::ExprKind::Path(ref qself, ref path) => qself.is_none() && path.segments.len() <= 1,
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _)
|
||||
| ast::ExprKind::Field(ref expr, _)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
@ -1361,7 +1359,6 @@ pub(crate) fn can_be_overflowed_expr(
|
||||
|
||||
// Handle unary-like expressions
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _) => can_be_overflowed_expr(context, expr, args_len),
|
||||
@ -1373,7 +1370,6 @@ pub(crate) fn is_nested_call(expr: &ast::Expr) -> bool {
|
||||
match expr.kind {
|
||||
ast::ExprKind::Call(..) | ast::ExprKind::MacCall(..) => true,
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _) => is_nested_call(expr),
|
||||
@ -2133,7 +2129,6 @@ pub(crate) fn is_method_call(expr: &ast::Expr) -> bool {
|
||||
match expr.kind {
|
||||
ast::ExprKind::MethodCall(..) => true,
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Cast(ref expr, _)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr) => is_method_call(expr),
|
||||
|
@ -592,7 +592,6 @@ fn can_flatten_block_around_this(body: &ast::Expr) -> bool {
|
||||
| ast::ExprKind::Struct(..)
|
||||
| ast::ExprKind::Tup(..) => true,
|
||||
ast::ExprKind::AddrOf(_, _, ref expr)
|
||||
| ast::ExprKind::Box(ref expr)
|
||||
| ast::ExprKind::Try(ref expr)
|
||||
| ast::ExprKind::Unary(_, ref expr)
|
||||
| ast::ExprKind::Index(ref expr, _)
|
||||
|
@ -492,7 +492,6 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
|
||||
| ast::ExprKind::Assign(..)
|
||||
| ast::ExprKind::AssignOp(..)
|
||||
| ast::ExprKind::Await(..)
|
||||
| ast::ExprKind::Box(..)
|
||||
| ast::ExprKind::Break(..)
|
||||
| ast::ExprKind::Cast(..)
|
||||
| ast::ExprKind::Continue(..)
|
||||
|
Loading…
Reference in New Issue
Block a user