about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2017-07-20 00:35:00 +0900
committerSeiichi Uchida <seuchida@gmail.com>2017-07-20 00:42:00 +0900
commita8b0a6e4c5524460ff7f181ffc0ca45758a02545 (patch)
tree6278f068c1777c2a9e1b7461db3fcbfd8b6aed31 /src
parent28e32ce898f84131baa35a7db34a399727d8f15f (diff)
Format source codes and update tests
Diffstat (limited to 'src')
-rw-r--r--src/expr.rs10
-rw-r--r--src/items.rs11
-rw-r--r--src/lists.rs2
-rw-r--r--src/string.rs2
-rw-r--r--src/summary.rs2
-rw-r--r--src/visitor.rs12
6 files changed, 19 insertions, 20 deletions
diff --git a/src/expr.rs b/src/expr.rs
index 327737d671c..d99a73b87ec 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1428,7 +1428,7 @@ fn block_contains_comment(block: &ast::Block, codemap: &CodeMap) -> bool {
 // the expression.
 pub fn is_simple_block(block: &ast::Block, codemap: &CodeMap) -> bool {
     (block.stmts.len() == 1 && stmt_is_expr(&block.stmts[0]) &&
-         !block_contains_comment(block, codemap))
+        !block_contains_comment(block, codemap))
 }
 
 /// Checks whether a block contains at most one statement or expression, and no comments.
@@ -1770,7 +1770,7 @@ fn rewrite_match_body(
             Some(ref body_str)
                 if !forbid_same_line &&
                     (is_block ||
-                         (!body_str.contains('\n') && body_str.len() <= body_shape.width)) =>
+                        (!body_str.contains('\n') && body_str.len() <= body_shape.width)) =>
             {
                 return combine_orig_body(body_str);
             }
@@ -2375,7 +2375,7 @@ pub fn wrap_args_with_parens(
 ) -> String {
     if !context.use_block_indent() ||
         (context.inside_macro && !args_str.contains('\n') &&
-             args_str.len() + paren_overhead(context) <= shape.width) || is_extendable
+            args_str.len() + paren_overhead(context) <= shape.width) || is_extendable
     {
         if context.config.spaces_within_parens() && args_str.len() > 0 {
             format!("( {} )", args_str)
@@ -2605,8 +2605,8 @@ pub fn wrap_struct_field(
 ) -> String {
     if context.config.struct_lit_style() == IndentStyle::Block &&
         (fields_str.contains('\n') ||
-             context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti ||
-             fields_str.len() > one_line_width)
+            context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti ||
+            fields_str.len() > one_line_width)
     {
         format!(
             "\n{}{}\n{}",
diff --git a/src/items.rs b/src/items.rs
index 4e989fe64e2..1b9c4495761 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -942,11 +942,10 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
         let has_body = !trait_items.is_empty();
 
         let where_density = if (context.config.where_density() == Density::Compressed &&
-                                    (!result.contains('\n') ||
-                                         context.config.fn_args_layout() == IndentStyle::Block)) ||
+            (!result.contains('\n') || context.config.fn_args_layout() == IndentStyle::Block)) ||
             (context.config.fn_args_layout() == IndentStyle::Block && result.is_empty()) ||
             (context.config.where_density() == Density::CompressedIfEmpty && !has_body &&
-                 !result.contains('\n'))
+                !result.contains('\n'))
         {
             Density::Compressed
         } else {
@@ -1079,7 +1078,7 @@ pub fn format_struct_struct(
             // 3 = ` {}`, 2 = ` {`.
             let overhead = if fields.is_empty() { 3 } else { 2 };
             if (context.config.item_brace_style() == BraceStyle::AlwaysNextLine &&
-                    !fields.is_empty()) ||
+                !fields.is_empty()) ||
                 context
                     .config
                     .max_width()
@@ -1247,8 +1246,8 @@ fn format_tuple_struct(
 
     if !where_clause_str.is_empty() && !where_clause_str.contains('\n') &&
         (result.contains('\n') ||
-             offset.block_indent + result.len() + where_clause_str.len() + 1 >
-                 context.config.max_width())
+            offset.block_indent + result.len() + where_clause_str.len() + 1 >
+                context.config.max_width())
     {
         // We need to put the where clause on a new line, but we didn't
         // know that earlier, so the where clause will not be indented properly.
diff --git a/src/lists.rs b/src/lists.rs
index 55db7cd9c00..6dfab314d97 100644
--- a/src/lists.rs
+++ b/src/lists.rs
@@ -368,7 +368,7 @@ where
         let inner_item_width = item.inner_as_ref().len();
         if !first &&
             (item.is_multiline() || !item.post_comment.is_some() ||
-                 inner_item_width + overhead > max_budget)
+                inner_item_width + overhead > max_budget)
         {
             return max_width;
         }
diff --git a/src/string.rs b/src/string.rs
index 00d8c0875e5..6cb2fcddaef 100644
--- a/src/string.rs
+++ b/src/string.rs
@@ -83,7 +83,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String>
                     if cur_end < cur_start + MIN_STRING {
                         cur_end = cur_start + max_chars;
                         while !(punctuation.contains(graphemes[cur_end - 1]) ||
-                                    graphemes[cur_end - 1].trim().is_empty())
+                            graphemes[cur_end - 1].trim().is_empty())
                         {
                             if cur_end >= graphemes.len() {
                                 let line = &graphemes[cur_start..].join("");
diff --git a/src/summary.rs b/src/summary.rs
index 5a169f8b80c..065e357ea95 100644
--- a/src/summary.rs
+++ b/src/summary.rs
@@ -54,7 +54,7 @@ impl Summary {
 
     pub fn has_no_errors(&self) -> bool {
         !(self.has_operational_errors || self.has_parsing_errors || self.has_formatting_errors ||
-              self.has_diff)
+            self.has_diff)
     }
 
     pub fn add(&mut self, other: Summary) {
diff --git a/src/visitor.rs b/src/visitor.rs
index 9ee7136bb63..6461fa89d6c 100644
--- a/src/visitor.rs
+++ b/src/visitor.rs
@@ -632,12 +632,12 @@ impl<'a> FmtVisitor<'a> {
                     .take_while(|ppi| {
                         is_use_item(&***ppi) &&
                             (!reorder_imports_in_group ||
-                                 {
-                                     let current = self.codemap.lookup_line_range(item_bound(&ppi));
-                                     let in_same_group = current.lo < last.hi + 2;
-                                     last = current;
-                                     in_same_group
-                                 })
+                                {
+                                    let current = self.codemap.lookup_line_range(item_bound(&ppi));
+                                    let in_same_group = current.lo < last.hi + 2;
+                                    last = current;
+                                    in_same_group
+                                })
                     })
                     .count();
                 let (use_items, rest) = items_left.split_at(use_item_length);