Use a correct budget for where predicate
This commit is contained in:
parent
1b84623aac
commit
eebad40932
@ -2484,7 +2484,9 @@ fn rewrite_where_clause_rfc_style(
|
|||||||
"\n".to_owned() + &block_shape.indent.to_string(context.config)
|
"\n".to_owned() + &block_shape.indent.to_string(context.config)
|
||||||
};
|
};
|
||||||
|
|
||||||
let clause_shape = block_shape.block_indent(context.config.tab_spaces());
|
let clause_shape = try_opt!(block_shape.block_left(context.config.tab_spaces()));
|
||||||
|
// 1 = `,`
|
||||||
|
let clause_shape = try_opt!(clause_shape.sub_width(1));
|
||||||
// each clause on one line, trailing comma (except if suppress_comma)
|
// each clause on one line, trailing comma (except if suppress_comma)
|
||||||
let span_start = where_clause.predicates[0].span().lo();
|
let span_start = where_clause.predicates[0].span().lo();
|
||||||
// If we don't have the start of the next span, then use the end of the
|
// If we don't have the start of the next span, then use the end of the
|
||||||
@ -2498,7 +2500,7 @@ fn rewrite_where_clause_rfc_style(
|
|||||||
terminator,
|
terminator,
|
||||||
|pred| pred.span().lo(),
|
|pred| pred.span().lo(),
|
||||||
|pred| pred.span().hi(),
|
|pred| pred.span().hi(),
|
||||||
|pred| pred.rewrite(context, block_shape),
|
|pred| pred.rewrite(context, clause_shape),
|
||||||
span_start,
|
span_start,
|
||||||
span_end,
|
span_end,
|
||||||
false,
|
false,
|
||||||
|
@ -463,7 +463,7 @@ impl Rewrite for ast::WherePredicate {
|
|||||||
let used_width = type_str.len() + colon.len();
|
let used_width = type_str.len() + colon.len();
|
||||||
let ty_shape = match context.config.where_style() {
|
let ty_shape = match context.config.where_style() {
|
||||||
Style::Legacy => try_opt!(shape.block_left(used_width)),
|
Style::Legacy => try_opt!(shape.block_left(used_width)),
|
||||||
Style::Rfc => shape.block_indent(context.config.tab_spaces()),
|
Style::Rfc => shape,
|
||||||
};
|
};
|
||||||
let bounds: Vec<_> = try_opt!(
|
let bounds: Vec<_> = try_opt!(
|
||||||
bounds
|
bounds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user