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