Skip to content

Commit ae6b098

Browse files
refactor: remove version gate on closure style
1 parent 19e5a4b commit ae6b098

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

src/closures.rs

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,12 @@ fn rewrite_closure_fn_decl(
239239
.sub_width(4)?;
240240

241241
let indent_style = context.config.indent_style();
242-
let version = context.config.version();
243242

244243
// 1 = |
245244
let param_offset = nested_shape.indent + 1;
246245
let param_shape = match indent_style {
247246
IndentStyle::Block => {
248-
if version == Version::Two {
249-
Shape::indented(shape.indent.block_indent(context.config), context.config)
250-
} else {
251-
nested_shape.offset_left(1)?.visual_indent(0)
252-
}
247+
Shape::indented(shape.indent.block_indent(context.config), context.config)
253248
}
254249
IndentStyle::Visual => nested_shape.offset_left(1)?.visual_indent(0),
255250
};
@@ -290,25 +285,24 @@ fn rewrite_closure_fn_decl(
290285
IndentStyle::Block => list_str.contains('\n') || list_str.len() > one_line_budget,
291286
_ => false,
292287
};
293-
let (param_str, put_params_in_block) =
294-
if multi_line_params && !item_vec.is_empty() && version == Version::Two {
295-
let trailing_comma = match context.config.trailing_comma() {
296-
SeparatorTactic::Never => "",
297-
_ => ",",
298-
};
299-
(
300-
format!(
301-
"{}{}{}{}",
302-
param_shape.indent.to_string_with_newline(context.config),
303-
&list_str,
304-
trailing_comma,
305-
shape.indent.to_string_with_newline(context.config)
306-
),
307-
true,
308-
)
309-
} else {
310-
(list_str, false)
288+
let (param_str, put_params_in_block) = if multi_line_params && !item_vec.is_empty() {
289+
let trailing_comma = match context.config.trailing_comma() {
290+
SeparatorTactic::Never => "",
291+
_ => ",",
311292
};
293+
(
294+
format!(
295+
"{}{}{}{}",
296+
param_shape.indent.to_string_with_newline(context.config),
297+
&list_str,
298+
trailing_comma,
299+
shape.indent.to_string_with_newline(context.config)
300+
),
301+
true,
302+
)
303+
} else {
304+
(list_str, false)
305+
};
312306
let mut prefix = format!("{}{}{}|{}|", is_async, immovable, mover, param_str);
313307

314308
if !ret_str.is_empty() {

0 commit comments

Comments
 (0)