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:
parent
17b04f181d
commit
f885039e6c
3 changed files with 16 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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")?);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -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")?
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue