Skip to content

Commit 261d325

Browse files
committed
Remove width of a trailing comma on variant
1 parent 3d7d978 commit 261d325

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/items.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ impl<'a> FmtVisitor<'a> {
534534

535535
let context = self.get_context();
536536
let indent = self.block_indent;
537-
let shape = self.shape();
537+
// 1 = ','
538+
let shape = self.shape().sub_width(1)?;
538539
let attrs_str = field.node.attrs.rewrite(&context, shape)?;
539540
let lo = field
540541
.node
@@ -555,8 +556,7 @@ impl<'a> FmtVisitor<'a> {
555556
}
556557
ast::VariantData::Unit(..) => if let Some(ref expr) = field.node.disr_expr {
557558
let lhs = format!("{} =", field.node.name);
558-
// 1 = ','
559-
rewrite_assign_rhs(&context, lhs, &**expr, shape.sub_width(1)?)?
559+
rewrite_assign_rhs(&context, lhs, &**expr, shape)?
560560
} else {
561561
field.node.name.to_string()
562562
},
@@ -1312,7 +1312,7 @@ fn format_tuple_struct(
13121312
}
13131313
result.push(')');
13141314
} else {
1315-
let shape = Shape::indented(offset, context.config);
1315+
let shape = Shape::indented(offset, context.config).sub_width(1)?;
13161316
let fields = &fields.iter().map(|field| field).collect::<Vec<_>>()[..];
13171317
let one_line_width = context.config.width_heuristics().fn_call_width;
13181318
result = rewrite_call_inner(context, &result, fields, span, shape, one_line_width, false)?;

0 commit comments

Comments
 (0)