Skip to content

Commit 7d63490

Browse files
committed
Update to the latest libsyntax changes
1 parent 5977f51 commit 7d63490

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

src/closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub fn rewrite_last_closure(
278278
expr: &ast::Expr,
279279
shape: Shape,
280280
) -> Option<String> {
281-
if let ast::ExprKind::Closure(capture, ref fn_decl, ref body, _) = expr.node {
281+
if let ast::ExprKind::Closure(capture, _, ref fn_decl, ref body, _) = expr.node {
282282
let body = match body.node {
283283
ast::ExprKind::Block(ref block)
284284
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) =>

src/expr.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ pub fn format_expr(
135135
ast::ExprKind::AssignOp(ref op, ref lhs, ref rhs) => {
136136
rewrite_assignment(context, lhs, rhs, Some(op), shape)
137137
}
138-
ast::ExprKind::Continue(ref opt_ident) => {
139-
let id_str = match *opt_ident {
140-
Some(ident) => format!(" {}", ident.node),
138+
ast::ExprKind::Continue(ref opt_label) => {
139+
let id_str = match *opt_label {
140+
Some(label) => format!(" {}", label.ident),
141141
None => String::new(),
142142
};
143143
Some(format!("continue{}", id_str))
144144
}
145-
ast::ExprKind::Break(ref opt_ident, ref opt_expr) => {
146-
let id_str = match *opt_ident {
147-
Some(ident) => format!(" {}", ident.node),
145+
ast::ExprKind::Break(ref opt_label, ref opt_expr) => {
146+
let id_str = match *opt_label {
147+
Some(label) => format!(" {}", label.ident),
148148
None => String::new(),
149149
};
150150

@@ -159,7 +159,7 @@ pub fn format_expr(
159159
} else {
160160
Some("yield".to_string())
161161
},
162-
ast::ExprKind::Closure(capture, ref fn_decl, ref body, _) => {
162+
ast::ExprKind::Closure(capture, _, ref fn_decl, ref body, _) => {
163163
closures::rewrite_closure(capture, fn_decl, body, expr.span, context, shape)
164164
}
165165
ast::ExprKind::Try(..)
@@ -718,7 +718,7 @@ struct ControlFlow<'a> {
718718
cond: Option<&'a ast::Expr>,
719719
block: &'a ast::Block,
720720
else_block: Option<&'a ast::Expr>,
721-
label: Option<ast::SpannedIdent>,
721+
label: Option<ast::Label>,
722722
pat: Option<&'a ast::Pat>,
723723
keyword: &'a str,
724724
matcher: &'a str,
@@ -795,11 +795,7 @@ impl<'a> ControlFlow<'a> {
795795
}
796796
}
797797

798-
fn new_loop(
799-
block: &'a ast::Block,
800-
label: Option<ast::SpannedIdent>,
801-
span: Span,
802-
) -> ControlFlow<'a> {
798+
fn new_loop(block: &'a ast::Block, label: Option<ast::Label>, span: Span) -> ControlFlow<'a> {
803799
ControlFlow {
804800
cond: None,
805801
block: block,
@@ -819,7 +815,7 @@ impl<'a> ControlFlow<'a> {
819815
pat: Option<&'a ast::Pat>,
820816
cond: &'a ast::Expr,
821817
block: &'a ast::Block,
822-
label: Option<ast::SpannedIdent>,
818+
label: Option<ast::Label>,
823819
span: Span,
824820
) -> ControlFlow<'a> {
825821
ControlFlow {
@@ -844,7 +840,7 @@ impl<'a> ControlFlow<'a> {
844840
pat: &'a ast::Pat,
845841
cond: &'a ast::Expr,
846842
block: &'a ast::Block,
847-
label: Option<ast::SpannedIdent>,
843+
label: Option<ast::Label>,
848844
span: Span,
849845
) -> ControlFlow<'a> {
850846
ControlFlow {
@@ -1166,9 +1162,9 @@ impl<'a> Rewrite for ControlFlow<'a> {
11661162
}
11671163
}
11681164

1169-
fn rewrite_label(label: Option<ast::SpannedIdent>) -> Cow<'static, str> {
1170-
match label {
1171-
Some(ident) => Cow::from(format!("{}: ", ident.node)),
1165+
fn rewrite_label(opt_label: Option<ast::Label>) -> Cow<'static, str> {
1166+
match opt_label {
1167+
Some(label) => Cow::from(format!("{}: ", label.ident)),
11721168
None => Cow::from(""),
11731169
}
11741170
}

0 commit comments

Comments
 (0)