Remove TODO from 'format_tuple_struct'
This commit is contained in:
parent
68c5915176
commit
9dc643a6ae
2 changed files with 18 additions and 27 deletions
43
src/items.rs
43
src/items.rs
|
@ -1041,33 +1041,24 @@ fn format_tuple_struct(context: &RewriteContext,
|
|||
.config
|
||||
.max_width
|
||||
.checked_sub(item_indent.width() + 3));
|
||||
let shape = Shape::legacy(item_budget, item_indent);
|
||||
|
||||
let items =
|
||||
itemize_list(context.codemap,
|
||||
fields.iter(),
|
||||
")",
|
||||
|field| {
|
||||
// Include attributes and doc comments, if present
|
||||
if !field.attrs.is_empty() {
|
||||
field.attrs[0].span.lo
|
||||
} else {
|
||||
field.span.lo
|
||||
}
|
||||
},
|
||||
|field| field.ty.span.hi,
|
||||
|field| field.rewrite(context, Shape::legacy(item_budget, item_indent)),
|
||||
context.codemap.span_after(span, "("),
|
||||
span.hi);
|
||||
let body_budget = try_opt!(context
|
||||
.config
|
||||
.max_width
|
||||
.checked_sub(offset.block_only().width() + result.len() +
|
||||
3));
|
||||
let body = try_opt!(list_helper(items,
|
||||
// TODO budget is wrong in block case
|
||||
Shape::legacy(body_budget, item_indent),
|
||||
context.config,
|
||||
tactic));
|
||||
let items = itemize_list(context.codemap,
|
||||
fields.iter(),
|
||||
")",
|
||||
|field| {
|
||||
// Include attributes and doc comments, if present
|
||||
if !field.attrs.is_empty() {
|
||||
field.attrs[0].span.lo
|
||||
} else {
|
||||
field.span.lo
|
||||
}
|
||||
},
|
||||
|field| field.ty.span.hi,
|
||||
|field| field.rewrite(context, shape),
|
||||
context.codemap.span_after(span, "("),
|
||||
span.hi);
|
||||
let body = try_opt!(list_helper(items, shape, context.config, tactic));
|
||||
|
||||
if context.config.fn_args_layout == IndentStyle::Visual || !body.contains('\n') {
|
||||
result.push('(');
|
||||
|
|
|
@ -158,7 +158,7 @@ impl Indent {
|
|||
let (num_tabs, num_spaces) = if config.hard_tabs {
|
||||
(self.block_indent / config.tab_spaces, self.alignment)
|
||||
} else {
|
||||
(0, self.block_indent + self.alignment)
|
||||
(0, self.width())
|
||||
};
|
||||
let num_chars = num_tabs + num_spaces;
|
||||
let mut indent = String::with_capacity(num_chars);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue