Update to the latest libsyntax changes

This commit is contained in:
Seiichi Uchida 2018-01-29 21:44:26 +09:00
parent 5977f516b1
commit 7d63490d85
2 changed files with 15 additions and 19 deletions

View File

@ -278,7 +278,7 @@ pub fn rewrite_last_closure(
expr: &ast::Expr,
shape: Shape,
) -> Option<String> {
if let ast::ExprKind::Closure(capture, ref fn_decl, ref body, _) = expr.node {
if let ast::ExprKind::Closure(capture, _, ref fn_decl, ref body, _) = expr.node {
let body = match body.node {
ast::ExprKind::Block(ref block)
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) =>

View File

@ -135,16 +135,16 @@ pub fn format_expr(
ast::ExprKind::AssignOp(ref op, ref lhs, ref rhs) => {
rewrite_assignment(context, lhs, rhs, Some(op), shape)
}
ast::ExprKind::Continue(ref opt_ident) => {
let id_str = match *opt_ident {
Some(ident) => format!(" {}", ident.node),
ast::ExprKind::Continue(ref opt_label) => {
let id_str = match *opt_label {
Some(label) => format!(" {}", label.ident),
None => String::new(),
};
Some(format!("continue{}", id_str))
}
ast::ExprKind::Break(ref opt_ident, ref opt_expr) => {
let id_str = match *opt_ident {
Some(ident) => format!(" {}", ident.node),
ast::ExprKind::Break(ref opt_label, ref opt_expr) => {
let id_str = match *opt_label {
Some(label) => format!(" {}", label.ident),
None => String::new(),
};
@ -159,7 +159,7 @@ pub fn format_expr(
} else {
Some("yield".to_string())
},
ast::ExprKind::Closure(capture, ref fn_decl, ref body, _) => {
ast::ExprKind::Closure(capture, _, ref fn_decl, ref body, _) => {
closures::rewrite_closure(capture, fn_decl, body, expr.span, context, shape)
}
ast::ExprKind::Try(..)
@ -718,7 +718,7 @@ struct ControlFlow<'a> {
cond: Option<&'a ast::Expr>,
block: &'a ast::Block,
else_block: Option<&'a ast::Expr>,
label: Option<ast::SpannedIdent>,
label: Option<ast::Label>,
pat: Option<&'a ast::Pat>,
keyword: &'a str,
matcher: &'a str,
@ -795,11 +795,7 @@ impl<'a> ControlFlow<'a> {
}
}
fn new_loop(
block: &'a ast::Block,
label: Option<ast::SpannedIdent>,
span: Span,
) -> ControlFlow<'a> {
fn new_loop(block: &'a ast::Block, label: Option<ast::Label>, span: Span) -> ControlFlow<'a> {
ControlFlow {
cond: None,
block: block,
@ -819,7 +815,7 @@ impl<'a> ControlFlow<'a> {
pat: Option<&'a ast::Pat>,
cond: &'a ast::Expr,
block: &'a ast::Block,
label: Option<ast::SpannedIdent>,
label: Option<ast::Label>,
span: Span,
) -> ControlFlow<'a> {
ControlFlow {
@ -844,7 +840,7 @@ impl<'a> ControlFlow<'a> {
pat: &'a ast::Pat,
cond: &'a ast::Expr,
block: &'a ast::Block,
label: Option<ast::SpannedIdent>,
label: Option<ast::Label>,
span: Span,
) -> ControlFlow<'a> {
ControlFlow {
@ -1166,9 +1162,9 @@ impl<'a> Rewrite for ControlFlow<'a> {
}
}
fn rewrite_label(label: Option<ast::SpannedIdent>) -> Cow<'static, str> {
match label {
Some(ident) => Cow::from(format!("{}: ", ident.node)),
fn rewrite_label(opt_label: Option<ast::Label>) -> Cow<'static, str> {
match opt_label {
Some(label) => Cow::from(format!("{}: ", label.ident)),
None => Cow::from(""),
}
}