Merge pull request #1572 from topecongiro/nested-block

Nesting of block indented expressions
This commit is contained in:
Nick Cameron 2017-05-23 18:35:21 +12:00 committed by GitHub
commit 7c8432f05b
10 changed files with 568 additions and 115 deletions

View File

@ -96,9 +96,7 @@ fn format_expr(expr: &ast::Expr,
expr.span,
shape)
}
ast::ExprKind::Tup(ref items) => {
rewrite_tuple(context, items.iter().map(|x| &**x), expr.span, shape)
}
ast::ExprKind::Tup(ref items) => rewrite_tuple(context, items, expr.span, shape),
ast::ExprKind::While(ref cond, ref block, label) => {
ControlFlow::new_while(None, cond, block, label, expr.span).rewrite(context, shape)
}
@ -1334,18 +1332,23 @@ impl Rewrite for ast::Arm {
let pats_str = format!("{}{}", pats_str, guard_str);
let body = match body.node {
let (mut extend, body) = match body.node {
ast::ExprKind::Block(ref block) if !is_unsafe_block(block) &&
is_simple_block(block, context.codemap) &&
context.config.wrap_match_arms() => {
if let ast::StmtKind::Expr(ref expr) = block.stmts[0].node {
expr
(false, &**expr)
} else {
&**body
(false, &**body)
}
}
_ => &**body,
ast::ExprKind::Call(_, ref args) => (args.len() == 1, &**body),
ast::ExprKind::Closure(..) |
ast::ExprKind::Struct(..) |
ast::ExprKind::Tup(..) => (true, &**body),
_ => (false, &**body),
};
extend &= context.config.fn_call_style() == IndentStyle::Block;
let comma = arm_comma(&context.config, body);
let alt_block_sep = String::from("\n") +
@ -1371,6 +1374,7 @@ impl Rewrite for ast::Arm {
Some(ref body_str) if (!body_str.contains('\n') &&
body_str.len() <= arm_shape.width) ||
!context.config.wrap_match_arms() ||
(extend && first_line_width(body_str) <= arm_shape.width) ||
is_block => {
let block_sep = match context.config.control_brace_style() {
ControlBraceStyle::AlwaysNextLine if is_block => alt_block_sep.as_str(),
@ -1608,12 +1612,11 @@ pub fn rewrite_call<R>(context: &RewriteContext,
-> Option<String>
where R: Rewrite
{
let closure =
|callee_max_width| rewrite_call_inner(context, callee, callee_max_width, args, span, shape);
let closure = |callee_max_width| {
rewrite_call_inner(context, callee, callee_max_width, args, span, shape, false)
};
// 2 is for parens
let max_width = try_opt!(shape.width.checked_sub(2));
binary_search(1, max_width, closure)
binary_search(1, shape.width, closure)
}
fn rewrite_call_inner<R>(context: &RewriteContext,
@ -1621,7 +1624,8 @@ fn rewrite_call_inner<R>(context: &RewriteContext,
max_callee_width: usize,
args: &[ptr::P<ast::Expr>],
span: Span,
shape: Shape)
shape: Shape,
force_trailing_comma: bool)
-> Result<String, Ordering>
where R: Rewrite
{
@ -1635,61 +1639,52 @@ fn rewrite_call_inner<R>(context: &RewriteContext,
.rewrite(context, callee_shape)
.ok_or(Ordering::Greater)?;
// 4 = `( )`, 2 = `()`
// 2 = `( `, 1 = `(`
let paren_overhead = if context.config.spaces_within_parens() {
4
} else {
2
} else {
1
};
let used_width = extra_offset(&callee_str, shape);
let one_line_width = shape
.width
.checked_sub(used_width + paren_overhead)
.checked_sub(used_width + 2 * paren_overhead)
.ok_or(Ordering::Greater)?;
let nested_shape = match context.config.fn_call_style() {
IndentStyle::Block => shape.block().block_left(context.config.tab_spaces()),
// 1 = (
IndentStyle::Visual => {
shape
.visual_indent(used_width + 1)
.sub_width(used_width + paren_overhead)
}
}
let nested_shape = shape_from_fn_call_style(context,
shape,
used_width + 2 * paren_overhead,
used_width + paren_overhead)
.ok_or(Ordering::Greater)?;
let span_lo = context.codemap.span_after(span, "(");
let span = mk_sp(span_lo, span.hi);
let list_str = rewrite_call_args(context, args, span, nested_shape, one_line_width)
let (extendable, list_str) = rewrite_call_args(context,
args,
span,
nested_shape,
one_line_width,
force_trailing_comma)
.ok_or(Ordering::Less)?;
let result = if context.config.fn_call_style() == IndentStyle::Visual ||
(!list_str.contains('\n') && list_str.chars().last().unwrap_or(' ') != ',') {
if context.config.spaces_within_parens() && list_str.len() > 0 {
format!("{}( {} )", callee_str, list_str)
} else {
format!("{}({})", callee_str, list_str)
}
} else {
format!("{}(\n{}{}\n{})",
callee_str,
nested_shape.indent.to_string(context.config),
list_str,
shape.block().indent.to_string(context.config))
};
Ok(result)
let arg_one_line_budget = min(one_line_width, context.config.fn_call_width());
Ok(format!("{}{}",
callee_str,
wrap_args_with_parens(context,
&list_str,
extendable,
arg_one_line_budget,
shape,
nested_shape)))
}
fn rewrite_call_args(context: &RewriteContext,
args: &[ptr::P<ast::Expr>],
span: Span,
shape: Shape,
one_line_width: usize)
-> Option<String> {
let arg_count = args.len();
one_line_width: usize,
force_trailing_comma: bool)
-> Option<(bool, String)> {
let items = itemize_list(context.codemap,
args.iter(),
")",
@ -1703,12 +1698,7 @@ fn rewrite_call_args(context: &RewriteContext,
// Try letting the last argument overflow to the next line with block
// indentation. If its first line fits on one line with the other arguments,
// we format the function arguments horizontally.
let overflow_last = match args.last().map(|x| &x.node) {
Some(&ast::ExprKind::Closure(..)) |
Some(&ast::ExprKind::Block(..)) |
Some(&ast::ExprKind::Match(..)) if arg_count > 1 => true,
_ => false,
};
let overflow_last = can_be_overflowed(context, args);
let mut orig_last = None;
let mut placeholder = None;
@ -1716,18 +1706,24 @@ fn rewrite_call_args(context: &RewriteContext,
// Replace the last item with its first line to see if it fits with
// first arguments.
if overflow_last {
let nested_shape = Shape {
indent: shape.indent.block_only(),
..shape
let arg_shape = if context.config.fn_call_style() == IndentStyle::Block &&
is_extendable(args) {
Shape {
width: context.config.fn_call_width(),
indent: shape.block().indent.block_unindent(context.config),
offset: 0,
}
} else {
shape.block()
};
let rewrite = args.last().unwrap().rewrite(context, nested_shape);
let rewrite = args.last().unwrap().rewrite(context, arg_shape);
swap(&mut item_vec[args.len() - 1].item, &mut orig_last);
if let Some(rewrite) = rewrite {
let rewrite_first_line = Some(rewrite[..first_line_width(&rewrite)].to_owned());
placeholder = Some(rewrite);
swap(&mut item_vec[arg_count - 1].item, &mut orig_last);
item_vec[arg_count - 1].item = rewrite_first_line;
item_vec[args.len() - 1].item = rewrite_first_line;
}
}
@ -1745,10 +1741,10 @@ fn rewrite_call_args(context: &RewriteContext,
// succeeded and its first line fits with the other arguments.
match (overflow_last, tactic, placeholder) {
(true, DefinitiveListTactic::Horizontal, placeholder @ Some(..)) => {
item_vec[arg_count - 1].item = placeholder;
item_vec[args.len() - 1].item = placeholder;
}
(true, _, _) => {
item_vec[arg_count - 1].item = orig_last;
item_vec[args.len() - 1].item = orig_last;
}
(false, _, _) => {}
}
@ -1756,9 +1752,10 @@ fn rewrite_call_args(context: &RewriteContext,
let mut fmt = ListFormatting {
tactic: tactic,
separator: ",",
trailing_separator: if context.inside_macro ||
context.config.fn_call_style() == IndentStyle::Visual ||
arg_count <= 1 {
trailing_separator: if force_trailing_comma {
SeparatorTactic::Always
} else if context.inside_macro || context.config.fn_call_style() == IndentStyle::Visual ||
args.len() <= 1 {
SeparatorTactic::Never
} else {
context.config.trailing_comma()
@ -1768,18 +1765,93 @@ fn rewrite_call_args(context: &RewriteContext,
config: context.config,
};
let args_in_single_line =
item_vec
.iter()
.rev()
.skip(1)
.all(|item| item.item.as_ref().map_or(false, |s| !s.contains('\n')));
match write_list(&item_vec, &fmt) {
// If arguments do not fit in a single line and do not contain newline,
// try to put it on the next line. Try this only when we are in block mode
// and not rewriting macro.
Some(ref s) if context.config.fn_call_style() == IndentStyle::Block &&
!context.inside_macro &&
(!s.contains('\n') &&
(s.len() > one_line_width || s.len() > context.config.fn_call_width())) => {
(!can_be_overflowed(context, args) && args.len() == 1 && s.contains('\n') ||
first_line_width(s) > one_line_width ||
first_line_width(s) > context.config.fn_call_width()) => {
fmt.trailing_separator = SeparatorTactic::Vertical;
write_list(&item_vec, &fmt)
fmt.tactic = DefinitiveListTactic::Vertical;
write_list(&item_vec, &fmt).map(|rw| (false, rw))
}
rewrite @ _ => rewrite,
rewrite @ _ => rewrite.map(|rw| (args_in_single_line && is_extendable(args), rw)),
}
}
fn can_be_overflowed(context: &RewriteContext, args: &[ptr::P<ast::Expr>]) -> bool {
match args.last().map(|x| &x.node) {
Some(&ast::ExprKind::Block(..)) |
Some(&ast::ExprKind::Match(..)) => {
(context.config.fn_call_style() == IndentStyle::Block && args.len() == 1) ||
(context.config.fn_call_style() == IndentStyle::Visual && args.len() > 1)
}
Some(&ast::ExprKind::Closure(..)) => {
context.config.fn_call_style() == IndentStyle::Block ||
context.config.fn_call_style() == IndentStyle::Visual && args.len() > 1
}
Some(&ast::ExprKind::Call(..)) |
Some(&ast::ExprKind::Struct(..)) => {
context.config.fn_call_style() == IndentStyle::Block && args.len() == 1
}
Some(&ast::ExprKind::Tup(..)) => context.config.fn_call_style() == IndentStyle::Block,
_ => false,
}
}
fn is_extendable(args: &[ptr::P<ast::Expr>]) -> bool {
if args.len() == 1 {
match args[0].node {
ast::ExprKind::Block(..) |
ast::ExprKind::Call(..) |
ast::ExprKind::Closure(..) |
ast::ExprKind::Match(..) |
ast::ExprKind::Struct(..) |
ast::ExprKind::Tup(..) => true,
_ => false,
}
} else if args.len() > 1 {
match args[args.len() - 1].node {
ast::ExprKind::Closure(..) |
ast::ExprKind::Tup(..) => true,
_ => false,
}
} else {
false
}
}
fn wrap_args_with_parens(context: &RewriteContext,
args_str: &str,
is_extendable: bool,
one_line_budget: usize,
shape: Shape,
nested_shape: Shape)
-> String {
if context.config.fn_call_style() == IndentStyle::Visual ||
(context.inside_macro && !args_str.contains('\n')) ||
((is_extendable || !args_str.contains('\n')) &&
first_line_width(&args_str) <= one_line_budget) {
if context.config.spaces_within_parens() && args_str.len() > 0 {
format!("( {} )", args_str)
} else {
format!("({})", args_str)
}
} else {
format!("(\n{}{}\n{})",
nested_shape.indent.to_string(context.config),
args_str,
shape.block().indent.to_string(context.config))
}
}
@ -1962,17 +2034,28 @@ fn rewrite_field(context: &RewriteContext, field: &ast::Field, shape: Shape) ->
}
}
pub fn rewrite_tuple<'a, I>(context: &RewriteContext,
mut items: I,
span: Span,
shape: Shape)
-> Option<String>
fn shape_from_fn_call_style(context: &RewriteContext,
shape: Shape,
overhead: usize,
offset: usize)
-> Option<Shape> {
match context.config.fn_call_style() {
IndentStyle::Block => Some(shape.block().block_indent(context.config.tab_spaces())),
IndentStyle::Visual => shape.visual_indent(offset).sub_width(overhead),
}
}
pub fn rewrite_tuple_type<'a, I>(context: &RewriteContext,
mut items: I,
span: Span,
shape: Shape)
-> Option<String>
where I: ExactSizeIterator,
<I as Iterator>::Item: Deref,
<I::Item as Deref>::Target: Rewrite + Spanned + 'a
{
debug!("rewrite_tuple {:?}", shape);
// In case of length 1, need a trailing comma
debug!("rewrite_tuple_type {:?}", shape);
if items.len() == 1 {
// 3 = "(" + ",)"
let nested_shape = try_opt!(shape.sub_width(3)).visual_indent(1);
@ -2006,6 +2089,29 @@ pub fn rewrite_tuple<'a, I>(context: &RewriteContext,
}
}
pub fn rewrite_tuple(context: &RewriteContext,
items: &[ptr::P<ast::Expr>],
span: Span,
shape: Shape)
-> Option<String> {
debug!("rewrite_tuple {:?}", shape);
// Use old `rewrite_tuple`
if context.config.fn_call_style() == IndentStyle::Visual {
return rewrite_tuple_type(context, items.iter().map(|x| &**x), span, shape);
}
// We use the same rule as funcation call for rewriting tuple.
// 1 = ","
rewrite_call_inner(context,
&String::new(),
shape.width.checked_sub(1).unwrap_or(0),
items,
span,
shape,
items.len() == 1)
.ok()
}
pub fn rewrite_unary_prefix<R: Rewrite>(context: &RewriteContext,
prefix: &str,
rewrite: &R,

View File

@ -22,7 +22,7 @@ use codemap::SpanUtils;
use lists::{format_item_list, itemize_list, format_fn_args};
use rewrite::{Rewrite, RewriteContext};
use utils::{extra_offset, format_mutability, colon_spaces, wrap_str};
use expr::{rewrite_unary_prefix, rewrite_pair, rewrite_tuple};
use expr::{rewrite_unary_prefix, rewrite_pair, rewrite_tuple_type};
use config::TypeDensity;
use itertools::Itertools;
@ -662,7 +662,7 @@ impl Rewrite for ast::Ty {
})
}
ast::TyKind::Tup(ref items) => {
rewrite_tuple(context, items.iter().map(|x| &**x), self.span, shape)
rewrite_tuple_type(context, items.iter().map(|x| &**x), self.span, shape)
}
ast::TyKind::Path(ref q_self, ref path) => {
rewrite_path(context, PathContext::Type, q_self.as_ref(), path, shape)

View File

@ -299,29 +299,32 @@ pub fn wrap_str<S: AsRef<str>>(s: S, max_width: usize, shape: Shape) -> Option<S
{
let snippet = s.as_ref();
if !snippet.contains('\n') && snippet.len() > shape.width {
return None;
} else {
let mut lines = snippet.lines();
// The caller of this function has already placed `shape.offset`
// characters on the first line.
let first_line_max_len = try_opt!(max_width.checked_sub(shape.indent.width()));
if lines.next().unwrap().len() > first_line_max_len {
if !snippet.is_empty() {
if !snippet.contains('\n') && snippet.len() > shape.width {
return None;
}
} else {
let mut lines = snippet.lines();
// The other lines must fit within the maximum width.
if lines.any(|line| line.len() > max_width) {
return None;
}
// The caller of this function has already placed `shape.offset`
// characters on the first line.
let first_line_max_len = try_opt!(max_width.checked_sub(shape.indent.width()));
if lines.next().unwrap().len() > first_line_max_len {
return None;
}
// `width` is the maximum length of the last line, excluding
// indentation.
// A special check for the last line, since the caller may
// place trailing characters on this line.
if snippet.lines().rev().next().unwrap().len() > shape.indent.width() + shape.width {
return None;
// The other lines must fit within the maximum width.
if lines.any(|line| line.len() > max_width) {
return None;
}
// `width` is the maximum length of the last line, excluding
// indentation.
// A special check for the last line, since the caller may
// place trailing characters on this line.
if snippet.lines().rev().next().unwrap().len() >
shape.indent.width() + shape.width {
return None;
}
}
}
}

View File

@ -4,4 +4,5 @@
// rustfmt should not add trailing comma when rewriting macro. See #1528.
fn a() {
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
foo(oooptoptoptoptptooptoptoptoptptooptoptoptoptptoptoptoptoptpt());
}

View File

@ -45,3 +45,54 @@ fn query(conn: &Connection) -> Result<()> {
Ok(())
}
// #1449
fn future_rayon_wait_1_thread() {
// run with only 1 worker thread; this would deadlock if we couldn't make progress
let mut result = None;
ThreadPool::new(Configuration::new().num_threads(1))
.unwrap()
.install(
|| {
scope(
|s| {
use std::sync::mpsc::channel;
let (tx, rx) = channel();
let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
// ^^^^ FIXME: why is this needed?
let b = s.spawn_future(a.map(|v| v + 1));
let c = s.spawn_future(b.map(|v| v + 1));
s.spawn(move |_| tx.send(20).unwrap());
result = Some(c.rayon_wait().unwrap());
},
);
},
);
assert_eq!(result, Some(22));
}
// #1494
impl Cursor {
fn foo() {
self.cur_type()
.num_template_args()
.or_else(|| {
let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
if n >= 0 {
Some(n as u32)
} else {
debug_assert_eq!(n, -1);
None
}
})
.or_else(|| {
let canonical = self.canonical();
if canonical != *self {
canonical.num_template_args()
} else {
None
}
});
}
}

View File

@ -143,3 +143,132 @@ fn foo() {
DefinitiveListTactic::Horizontal
}
}
fn combine_block() {
foo(
Bar {
x: value,
y: value2,
},
);
foo((Bar {
x: value,
y: value2,
},));
foo((1, 2, 3, Bar {
x: value,
y: value2,
}));
foo((1, 2, 3, |x| {
let y = x + 1;
let z = y + 1;
z
}));
let opt = Some(
Struct(
long_argument_one,
long_argument_two,
long_argggggggg,
),
);
do_thing(
|param| {
action();
foo(param)
},
);
do_thing(
x,
|param| {
action();
foo(param)
},
);
do_thing(
x,
(
1,
2,
3,
|param| {
action();
foo(param)
},
),
);
Ok(
some_function(
lllllllllong_argument_one,
lllllllllong_argument_two,
lllllllllllllllllllllllllllllong_argument_three,
),
);
foo(
thing,
bar(
param2,
pparam1param1param1param1param1param1param1param1param1param1aram1,
param3,
),
);
foo.map_or(
|| {
Ok(
SomeStruct {
f1: 0,
f2: 0,
f3: 0,
},
)
},
);
match opt {
Some(x) => somefunc(anotherfunc(
long_argument_one,
long_argument_two,
long_argument_three,
)),
Some(x) => |x| {
let y = x + 1;
let z = y + 1;
z
},
Some(x) => (1, 2, |x| {
let y = x + 1;
let z = y + 1;
z
}),
Some(x) => SomeStruct {
f1: long_argument_one,
f2: long_argument_two,
f3: long_argument_three,
},
None => Ok(SomeStruct {
f1: long_argument_one,
f2: long_argument_two,
f3: long_argument_three,
}),
};
match x {
y => func(
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
),
_ => func(
x,
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
zzz,
),
}
}

View File

@ -1,15 +1,13 @@
// rustfmt-fn_call_style: Block
// #1547
fuzz_target!(
|data: &[u8]| {
if let Some(first) = data.first() {
let index = *first as usize;
if index >= ENCODINGS.len() {
return;
}
let encoding = ENCODINGS[index];
dispatch_test(encoding, &data[1..]);
fuzz_target!(|data: &[u8]| {
if let Some(first) = data.first() {
let index = *first as usize;
if index >= ENCODINGS.len() {
return;
}
let encoding = ENCODINGS[index];
dispatch_test(encoding, &data[1..]);
}
);
});

View File

@ -4,4 +4,7 @@
// rustfmt should not add trailing comma when rewriting macro. See #1528.
fn a() {
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
foo(
oooptoptoptoptptooptoptoptoptptooptoptoptoptptoptoptoptoptpt(),
);
}

View File

@ -13,18 +13,20 @@ fn main() {
"elit",
);
// #1501
let hyper = Arc::new(
Client::with_connector(HttpsConnector::new(TlsClient::new())),
);
let hyper = Arc::new(Client::with_connector(
HttpsConnector::new(TlsClient::new()),
));
}
// #1521
impl Foo {
fn map_pixel_to_coords(&self, point: &Vector2i, view: &View) -> Vector2f {
unsafe {
Vector2f::from_raw(
ffi::sfRenderTexture_mapPixelToCoords(self.render_texture, point.raw(), view.raw()),
)
Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
self.render_texture,
point.raw(),
view.raw(),
))
}
}
}
@ -34,7 +36,7 @@ fn issue1420() {
r#"
# Getting started
...
"#
"#,
)
.running(waltz)
}
@ -58,3 +60,50 @@ fn query(conn: &Connection) -> Result<()> {
Ok(())
}
// #1449
fn future_rayon_wait_1_thread() {
// run with only 1 worker thread; this would deadlock if we couldn't make progress
let mut result = None;
ThreadPool::new(Configuration::new().num_threads(1))
.unwrap()
.install(|| {
scope(|s| {
use std::sync::mpsc::channel;
let (tx, rx) = channel();
let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
// ^^^^ FIXME: why is this needed?
let b = s.spawn_future(a.map(|v| v + 1));
let c = s.spawn_future(b.map(|v| v + 1));
s.spawn(move |_| tx.send(20).unwrap());
result = Some(c.rayon_wait().unwrap());
});
});
assert_eq!(result, Some(22));
}
// #1494
impl Cursor {
fn foo() {
self.cur_type()
.num_template_args()
.or_else(|| {
let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
if n >= 0 {
Some(n as u32)
} else {
debug_assert_eq!(n, -1);
None
}
})
.or_else(|| {
let canonical = self.canonical();
if canonical != *self {
canonical.num_template_args()
} else {
None
}
});
}
}

View File

@ -102,7 +102,7 @@ fn arrays() {
Weighted { weight: 1, item: 1 },
Weighted { weight: x, item: 2 },
Weighted { weight: 1, item: 3 },
]
],
);
let z = [
@ -213,3 +213,116 @@ fn foo() {
DefinitiveListTactic::Horizontal
}
}
fn combine_block() {
foo(Bar {
x: value,
y: value2,
});
foo((Bar {
x: value,
y: value2,
},));
foo((
1,
2,
3,
Bar {
x: value,
y: value2,
},
));
foo((1, 2, 3, |x| {
let y = x + 1;
let z = y + 1;
z
}));
let opt = Some(Struct(
long_argument_one,
long_argument_two,
long_argggggggg,
));
do_thing(|param| {
action();
foo(param)
});
do_thing(x, |param| {
action();
foo(param)
});
do_thing(x, (1, 2, 3, |param| {
action();
foo(param)
}));
Ok(some_function(
lllllllllong_argument_one,
lllllllllong_argument_two,
lllllllllllllllllllllllllllllong_argument_three,
));
foo(
thing,
bar(
param2,
pparam1param1param1param1param1param1param1param1param1param1aram1,
param3,
),
);
foo.map_or(|| {
Ok(SomeStruct {
f1: 0,
f2: 0,
f3: 0,
})
});
match opt {
Some(x) => somefunc(anotherfunc(
long_argument_one,
long_argument_two,
long_argument_three,
)),
Some(x) => |x| {
let y = x + 1;
let z = y + 1;
z
},
Some(x) => (1, 2, |x| {
let y = x + 1;
let z = y + 1;
z
}),
Some(x) => SomeStruct {
f1: long_argument_one,
f2: long_argument_two,
f3: long_argument_three,
},
None => Ok(SomeStruct {
f1: long_argument_one,
f2: long_argument_two,
f3: long_argument_three,
}),
};
match x {
y => func(
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
),
_ => {
func(
x,
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
zzz,
)
}
}
}