Do not overflow a long item

Take the first line's width of a single item into account when
trying to overflow something.

Closes #2676.
This commit is contained in:
topecongiro 2018-05-06 12:12:16 +09:00
parent 17b04f181d
commit f885039e6c
3 changed files with 16 additions and 1 deletions

View file

@ -422,7 +422,7 @@ impl<'a, T: 'a + Rewrite + ToExpr + Spanned> Context<'a, T> {
let extend_width = if items_str.is_empty() { let extend_width = if items_str.is_empty() {
paren_overhead paren_overhead
} else { } else {
paren_overhead / 2 first_line_width(items_str) + (paren_overhead / 2)
}; };
let nested_indent_str = self.nested_shape let nested_indent_str = self.nested_shape
.indent .indent

View file

@ -391,3 +391,10 @@ fn dots() {
..= ..= ..; ..= ..= ..;
(..) .. ..; // ((..) .. (..)) (..) .. ..; // ((..) .. (..))
} }
// #2676
// A function call with a large single argument.
fn foo() {
let my_var =
Mutex::new(RpcClientType::connect(server_iddd).chain_err(|| "Unable to create RPC client")?);
}

View file

@ -416,3 +416,11 @@ fn dots() {
..= ..= ..; ..= ..= ..;
(..).. ..; // ((..) .. (..)) (..).. ..; // ((..) .. (..))
} }
// #2676
// A function call with a large single argument.
fn foo() {
let my_var = Mutex::new(
RpcClientType::connect(server_iddd).chain_err(|| "Unable to create RPC client")?
);
}