diff --git a/src/chains.rs b/src/chains.rs index 816ce60ad4d9..7512ef72e275 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -419,10 +419,12 @@ fn rewrite_chain_subexpr( context: &RewriteContext, shape: Shape, ) -> Option { - let rewrite_element = |expr_str: String| if expr_str.len() <= shape.width { - Some(expr_str) - } else { - None + let rewrite_element = |expr_str: String| { + if expr_str.len() <= shape.width { + Some(expr_str) + } else { + None + } }; match expr.node { diff --git a/src/expr.rs b/src/expr.rs index 259ac0007ed6..ed4adffb9f59 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2316,12 +2316,13 @@ fn rewrite_paren(context: &RewriteContext, subexpr: &ast::Expr, shape: Shape) -> .offset_left(paren_overhead) .and_then(|s| s.sub_width(paren_overhead))?; - let paren_wrapper = - |s: &str| if context.config.spaces_within_parens_and_brackets() && !s.is_empty() { + let paren_wrapper = |s: &str| { + if context.config.spaces_within_parens_and_brackets() && !s.is_empty() { format!("( {} )", s) } else { format!("({})", s) - }; + } + }; let subexpr_str = subexpr.rewrite(context, sub_shape)?; debug!("rewrite_paren, subexpr_str: `{:?}`", subexpr_str); diff --git a/src/items.rs b/src/items.rs index b3647f26f533..496c66971d7d 100644 --- a/src/items.rs +++ b/src/items.rs @@ -482,10 +482,12 @@ fn format_variant_list( enum_def.variants.iter(), "}", ",", - |f| if !f.node.attrs.is_empty() { - f.node.attrs[0].span.lo() - } else { - f.span.lo() + |f| { + if !f.node.attrs.is_empty() { + f.node.attrs[0].span.lo() + } else { + f.span.lo() + } }, |f| f.span.hi(), |f| self.format_variant(f, one_line_width), @@ -2549,10 +2551,12 @@ fn rewrite_where_clause_rfc_style( }; let preds_str = write_list(&items.collect::>(), &fmt)?; - let comment_separator = |comment: &str, shape: Shape| if comment.is_empty() { - String::new() - } else { - format!("\n{}", shape.indent.to_string(context.config)) + let comment_separator = |comment: &str, shape: Shape| { + if comment.is_empty() { + String::new() + } else { + format!("\n{}", shape.indent.to_string(context.config)) + } }; let newline_before_where = comment_separator(&comment_before, shape); let newline_after_where = comment_separator(&comment_after, clause_shape);