Fix breaking changes from introducing AnonConst

This commit is contained in:
topecongiro 2018-05-23 06:04:14 +09:00
parent 6c7c770c80
commit a6b32d944c
3 changed files with 6 additions and 5 deletions

@ -228,7 +228,7 @@ pub fn format_expr(
}
ast::ExprKind::Repeat(ref expr, ref repeats) => rewrite_pair(
&**expr,
&**repeats,
&*repeats.value,
PairParts::new("[", "; ", "]"),
context,
shape,
@ -1469,8 +1469,9 @@ fn is_simple_expr(expr: &ast::Expr) -> bool {
| ast::ExprKind::Field(ref expr, _)
| ast::ExprKind::Try(ref expr)
| ast::ExprKind::Unary(_, ref expr) => is_simple_expr(expr),
ast::ExprKind::Index(ref lhs, ref rhs) | ast::ExprKind::Repeat(ref lhs, ref rhs) => {
is_simple_expr(lhs) && is_simple_expr(rhs)
ast::ExprKind::Index(ref lhs, ref rhs) => is_simple_expr(lhs) && is_simple_expr(rhs),
ast::ExprKind::Repeat(ref lhs, ref rhs) => {
is_simple_expr(lhs) && is_simple_expr(&*rhs.value)
}
_ => false,
}

@ -572,7 +572,7 @@ impl<'a> FmtVisitor<'a> {
ast::VariantData::Unit(..) => {
if let Some(ref expr) = field.node.disr_expr {
let lhs = format!("{} =", field.node.ident.name);
rewrite_assign_rhs(&context, lhs, &**expr, shape)?
rewrite_assign_rhs(&context, lhs, &*expr.value, shape)?
} else {
field.node.ident.name.to_string()
}

@ -656,7 +656,7 @@ impl Rewrite for ast::Ty {
}
ast::TyKind::Array(ref ty, ref repeats) => rewrite_pair(
&**ty,
&**repeats,
&*repeats.value,
PairParts::new("[", "; ", "]"),
context,
shape,