]> git.lizzy.rs Git - rust.git/commitdiff
Format
authorSeiichi Uchida <seuchida@gmail.com>
Sun, 5 Aug 2018 06:04:48 +0000 (15:04 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Sun, 5 Aug 2018 06:04:48 +0000 (15:04 +0900)
src/chains.rs

index 391d8a599724a58e643a28f23164f12e859d9cf5..9d0e8c7c6d282f9d8182d2ae2f1f8ae667727f9e 100644 (file)
@@ -187,9 +187,12 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
             ChainItemKind::TupleField(ident, nested) => {
                 format!("{}.{}", if nested { " " } else { "" }, ident.name)
             }
-            ChainItemKind::Comment => {
-                rewrite_comment(context.snippet(self.span).trim(), false, shape, context.config)?
-            }
+            ChainItemKind::Comment => rewrite_comment(
+                context.snippet(self.span).trim(),
+                false,
+                shape,
+                context.config,
+            )?,
         };
         Some(format!("{}{}", rewrite, "?".repeat(self.tries)))
     }
@@ -471,8 +474,7 @@ fn format_last_child(
             min(shape.width, context.config.width_heuristics().chain_width)
         }.saturating_sub(almost_total);
 
-        let all_in_one_line =
-            !self.children.iter().any(ChainItem::is_comment)
+        let all_in_one_line = !self.children.iter().any(ChainItem::is_comment)
             && self.rewrites.iter().all(|s| !s.contains('\n'))
             && one_line_budget > 0;
         let last_shape = if all_in_one_line {