From 7d63490d8573eca400260f836ae6a75555620b4f Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Mon, 29 Jan 2018 21:44:26 +0900 Subject: [PATCH] Update to the latest libsyntax changes --- src/closures.rs | 2 +- src/expr.rs | 32 ++++++++++++++------------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/closures.rs b/src/closures.rs index f63242f6355..b9009598f1a 100644 --- a/src/closures.rs +++ b/src/closures.rs @@ -278,7 +278,7 @@ pub fn rewrite_last_closure( expr: &ast::Expr, shape: Shape, ) -> Option { - 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) => diff --git a/src/expr.rs b/src/expr.rs index 5965f3007b4..dc18a7f532e 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -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, + label: Option, 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, - span: Span, - ) -> ControlFlow<'a> { + fn new_loop(block: &'a ast::Block, label: Option, 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, + label: Option, 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, + label: Option, span: Span, ) -> ControlFlow<'a> { ControlFlow { @@ -1166,9 +1162,9 @@ impl<'a> Rewrite for ControlFlow<'a> { } } -fn rewrite_label(label: Option) -> Cow<'static, str> { - match label { - Some(ident) => Cow::from(format!("{}: ", ident.node)), +fn rewrite_label(opt_label: Option) -> Cow<'static, str> { + match opt_label { + Some(label) => Cow::from(format!("{}: ", label.ident)), None => Cow::from(""), } }