Put a space between nested tuple field

This commit is contained in:
topecongiro 2017-05-30 20:40:05 +09:00
parent b79094262f
commit b63e3aaa83
3 changed files with 13 additions and 1 deletions

View File

@ -454,7 +454,13 @@ fn rewrite_chain_subexpr(expr: &ast::Expr,
rewrite_method_call(method_name.node, types, expressions, span, context, shape)
}
ast::ExprKind::Field(_, ref field) => rewrite_element(format!(".{}", field.node)),
ast::ExprKind::TupField(_, ref field) => rewrite_element(format!(".{}", field.node)),
ast::ExprKind::TupField(ref expr, ref field) => {
let space = match expr.node {
ast::ExprKind::TupField(..) => " ",
_ => "",
};
rewrite_element(format!("{}.{}", space, field.node))
}
ast::ExprKind::Try(_) => rewrite_element(String::from("?")),
_ => unreachable!(),
}

View File

@ -12,6 +12,9 @@ fn foo() {
let b = (// This is a comment
b, // Comment
b /* Trailing comment */);
// #1063
foo(x.0 .0);
}
fn a() {

View File

@ -12,6 +12,9 @@ fn foo() {
let b = (// This is a comment
b, // Comment
b /* Trailing comment */);
// #1063
foo(x.0 .0);
}
fn a() {