use ast;
pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
match e.node {
ast::ExprIf(..)
| ast::ExprIfLet(..)
| ast::ExprMatch(..)
| ast::ExprBlock(_)
| ast::ExprWhile(..)
| ast::ExprWhileLet(..)
| ast::ExprLoop(..)
| ast::ExprForLoop(..) => false,
_ => true
}
}
pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
match e.node {
ast::ExprBlock(ref block) => block.rules == ast::DefaultBlock,
_ => false
}
}
pub fn stmt_ends_with_semi(stmt: &ast::Stmt_) -> bool {
match *stmt {
ast::StmtDecl(ref d, _) => {
match d.node {
ast::DeclLocal(_) => true,
ast::DeclItem(_) => false
}
}
ast::StmtExpr(ref e, _) => { expr_requires_semi_to_be_stmt(&**e) }
ast::StmtSemi(..) => { false }
ast::StmtMac(..) => { false }
}
}