Merge pull request #2128 from topecongiro/issue-2125

Wrap long single field tuple struct
This commit is contained in:
Nick Cameron 2017-11-08 21:11:21 +13:00 committed by GitHub
commit 0c250d0e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -1281,17 +1281,10 @@ fn format_tuple_struct(
}
result.push(')');
} else {
// 1 = ","
let body = rewrite_call_inner(
context,
"",
&fields.iter().map(|field| field).collect::<Vec<_>>()[..],
span,
Shape::indented(offset, context.config).sub_width(1)?,
context.config.fn_call_width(),
false,
)?;
result.push_str(&body);
let shape = Shape::indented(offset, context.config);
let fields = &fields.iter().map(|field| field).collect::<Vec<_>>()[..];
let one_line_width = context.config.fn_call_width();
result = rewrite_call_inner(context, &result, fields, span, shape, one_line_width, false)?;
}
if !where_clause_str.is_empty() && !where_clause_str.contains('\n')

View File

@ -266,3 +266,6 @@ pub(crate) struct Foo{}
pub(in self) struct Foo();
pub(super) struct Foo();
pub(crate) struct Foo();
// #2125
pub struct ReadinessCheckRegistry(Mutex<HashMap<Arc<String>, Box<Fn() -> ReadinessCheck + Sync + Send>>>);

View File

@ -308,3 +308,8 @@ pub(crate) struct Foo {}
pub(self) struct Foo();
pub(super) struct Foo();
pub(crate) struct Foo();
// #2125
pub struct ReadinessCheckRegistry(
Mutex<HashMap<Arc<String>, Box<Fn() -> ReadinessCheck + Sync + Send>>>,
);