From 91bd1fdc86f9891d063b11c87cee28aa3728fac0 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sat, 17 Jun 2017 21:17:20 +0900 Subject: [PATCH] Format source codes --- src/chains.rs | 3 +-- src/items.rs | 9 +++------ src/patterns.rs | 3 +-- src/visitor.rs | 6 ++---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/chains.rs b/src/chains.rs index 1729505d63b..fb26fb2ff7d 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -226,8 +226,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - total_span, context, shape, - ) - { + ) { // If the first line of the last method does not fit into a single line // after the others, allow new lines. almost_total + first_line_width(&last[0]) < context.config.max_width() diff --git a/src/items.rs b/src/items.rs index 09d866ccf8d..b7c26574838 100644 --- a/src/items.rs +++ b/src/items.rs @@ -588,8 +588,7 @@ pub fn format_impl( &result, &where_clause_str, &item, - )) - { + )) { result.push_str(&where_clause_str); if where_clause_str.contains('\n') { let white_space = offset.to_string(context.config); @@ -736,8 +735,7 @@ fn format_impl_ref_and_type( true, polarity_str, result_len, - ) - { + ) { result.push_str(&trait_ref_str); } else { let generics_str = try_opt!(rewrite_generics_inner( @@ -2114,8 +2112,7 @@ fn rewrite_fn_base( !has_braces, put_args_in_block && ret_str.is_empty(), Some(span.hi), - ) - { + ) { if !where_clause_str.contains('\n') { if last_line_width(&result) + where_clause_str.len() > context.config.max_width() { result.push('\n'); diff --git a/src/patterns.rs b/src/patterns.rs index 1899944bc10..ed444210081 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -376,8 +376,7 @@ fn count_wildcard_suffix_len( for item in items.iter().rev().take_while(|i| match i.item { Some(ref internal_string) if internal_string == "_" => true, _ => false, - }) - { + }) { suffix_len += 1; if item.pre_comment.is_some() || item.post_comment.is_some() { diff --git a/src/visitor.rs b/src/visitor.rs index d20b4e971b5..b34108800e7 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -298,8 +298,7 @@ impl<'a> FmtVisitor<'a> { item, self.block_indent, where_span_end, - ) - { + ) { self.buffer.push_str(&impl_str); self.last_pos = source!(self, item.span).hi; } @@ -310,8 +309,7 @@ impl<'a> FmtVisitor<'a> { &self.get_context(), item, self.block_indent, - ) - { + ) { self.buffer.push_str(&trait_str); self.last_pos = source!(self, item.span).hi; }