Skip to content

Commit 922e8ba

Browse files
Self format rustfmt
1 parent 3126770 commit 922e8ba

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

src/closures.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -391,26 +391,22 @@ pub(crate) fn rewrite_last_closure(
391391

392392
// We force to use block for the body of the closure for certain kinds of expressions.
393393
if is_block_closure_forced(context, body) {
394-
return rewrite_closure_with_block(body, &prefix, context, body_shape).map(
395-
|body_str| {
396-
match fn_decl.output {
397-
ast::FnRetTy::Default(..) if body_str.lines().count() <= 7 => {
398-
// If the expression can fit in a single line, we need not force block
399-
// closure. However, if the closure has a return type, then we must
400-
// keep the blocks.
401-
match rewrite_closure_expr(body, &prefix, context, shape) {
402-
Some(single_line_body_str)
403-
if !single_line_body_str.contains('\n') =>
404-
{
405-
single_line_body_str
406-
}
407-
_ => body_str,
394+
return rewrite_closure_with_block(body, &prefix, context, body_shape).map(|body_str| {
395+
match fn_decl.output {
396+
ast::FnRetTy::Default(..) if body_str.lines().count() <= 7 => {
397+
// If the expression can fit in a single line, we need not force block
398+
// closure. However, if the closure has a return type, then we must
399+
// keep the blocks.
400+
match rewrite_closure_expr(body, &prefix, context, shape) {
401+
Some(single_line_body_str) if !single_line_body_str.contains('\n') => {
402+
single_line_body_str
408403
}
404+
_ => body_str,
409405
}
410-
_ => body_str,
411406
}
412-
},
413-
);
407+
_ => body_str,
408+
}
409+
});
414410
}
415411

416412
// When overflowing the closure which consists of a single control flow expression,

src/expr.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ pub(crate) fn format_expr(
6464
if contains_skip(&*expr.attrs) {
6565
return Some(context.snippet(expr.span()).to_owned());
6666
}
67-
let shape = if context.config.version() == Version::One && expr_type == ExprType::Statement
67+
let shape = if context.config.version() == Version::One
68+
&& expr_type == ExprType::Statement
6869
&& semicolon_for_expr_extra_hacky_double_counted_spacing(context, expr)
6970
{
7071
shape.sub_width(1)?

src/macros.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,7 @@ fn rewrite_macro_inner(
240240
} = match parse_macro_args(context, ts, style, is_forced_bracket) {
241241
Some(args) => args,
242242
None => {
243-
return return_macro_parse_failure_fallback(
244-
context,
245-
shape.indent,
246-
position,
247-
mac.span(),
248-
);
243+
return return_macro_parse_failure_fallback(context, shape.indent, position, mac.span());
249244
}
250245
};
251246

0 commit comments

Comments
 (0)