Skip to content

Commit 3762d80

Browse files
authored
Merge pull request #2678 from topecongiro/issue-2676
Do not overflow a long item
2 parents 17b04f1 + f885039 commit 3762d80

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl<'a, T: 'a + Rewrite + ToExpr + Spanned> Context<'a, T> {
422422
let extend_width = if items_str.is_empty() {
423423
paren_overhead
424424
} else {
425-
paren_overhead / 2
425+
first_line_width(items_str) + (paren_overhead / 2)
426426
};
427427
let nested_indent_str = self.nested_shape
428428
.indent

tests/source/expr.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,10 @@ fn dots() {
391391
..= ..= ..;
392392
(..) .. ..; // ((..) .. (..))
393393
}
394+
395+
// #2676
396+
// A function call with a large single argument.
397+
fn foo() {
398+
let my_var =
399+
Mutex::new(RpcClientType::connect(server_iddd).chain_err(|| "Unable to create RPC client")?);
400+
}

tests/target/expr.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,11 @@ fn dots() {
416416
..= ..= ..;
417417
(..).. ..; // ((..) .. (..))
418418
}
419+
420+
// #2676
421+
// A function call with a large single argument.
422+
fn foo() {
423+
let my_var = Mutex::new(
424+
RpcClientType::connect(server_iddd).chain_err(|| "Unable to create RPC client")?
425+
);
426+
}

0 commit comments

Comments
 (0)