Skip to content

Commit

Permalink
Remove nested flag from TupleField
Browse files Browse the repository at this point in the history
  • Loading branch information
sasurau4 authored and calebcartwright committed Dec 9, 2020
1 parent 28799b8 commit 8a4782b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/formatting/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ enum ChainItemKind {
Vec<ptr::P<ast::Expr>>,
),
StructField(symbol::Ident),
TupleField(symbol::Ident, bool),
TupleField(symbol::Ident),
Await,
Comment(String, CommentPosition),
}
Expand Down Expand Up @@ -171,7 +171,7 @@ impl ChainItemKind {
}
ast::ExprKind::Field(ref nested, field) => {
let kind = if Self::is_tup_field_access(expr) {
ChainItemKind::TupleField(field, Self::is_tup_field_access(nested))
ChainItemKind::TupleField(field)
} else {
ChainItemKind::StructField(field)
};
Expand Down Expand Up @@ -199,12 +199,9 @@ impl Rewrite for ChainItem {
ChainItemKind::MethodCall(ref segment, ref types, ref exprs) => {
Self::rewrite_method_call(segment.ident, types, exprs, self.span, context, shape)?
}
ChainItemKind::StructField(ident) => format!(".{}", rewrite_ident(context, ident)),
ChainItemKind::TupleField(ident, nested) => format!(
"{}.{}",
if nested { " " } else { "" },
rewrite_ident(context, ident)
),
ChainItemKind::StructField(ident) | ChainItemKind::TupleField(ident) => {
format!(".{}", rewrite_ident(context, ident))
}
ChainItemKind::Await => ".await".to_owned(),
ChainItemKind::Comment(ref comment, _) => {
rewrite_comment(comment, false, shape, context.config)?
Expand Down

0 comments on commit 8a4782b

Please sign in to comment.