]> git.lizzy.rs Git - rust.git/commitdiff
Format rustfmt's own indices
authorMarcus Klaas <mail@marcusklaas.nl>
Fri, 2 Oct 2015 09:48:52 +0000 (11:48 +0200)
committerMarcus Klaas <mail@marcusklaas.nl>
Fri, 2 Oct 2015 09:48:52 +0000 (11:48 +0200)
src/expr.rs
src/items.rs
src/lists.rs
src/missed_spans.rs
src/visitor.rs

index 75630eb8301468efe3332ce8d1e5c01f615c8144..b68cbb8758092b756cdb73e0c23c9e57556fe5b4 100644 (file)
@@ -756,7 +756,7 @@ fn rewrite_match_arm_comment(context: &RewriteContext,
                              -> Option<String> {
     // The leading "," is not part of the arm-comment
     let missed_str = match missed_str.find_uncommented(",") {
-        Some(n) => &missed_str[n+1..],
+        Some(n) => &missed_str[n + 1..],
         None => &missed_str[..],
     };
 
@@ -816,7 +816,7 @@ fn rewrite_match(context: &RewriteContext,
         let missed_str = if i == 0 {
             context.snippet(mk_sp(open_brace_pos, arm_start_pos(arm)))
         } else {
-            context.snippet(mk_sp(arm_end_pos(&arms[i-1]), arm_start_pos(arm)))
+            context.snippet(mk_sp(arm_end_pos(&arms[i - 1]), arm_start_pos(arm)))
         };
         let comment = try_opt!(rewrite_match_arm_comment(context,
                                                          &missed_str,
index e6a334d9ad306129efbb03f9f29365dda620a4a5..827b528771ef757fe0e1b6d4bfaa5316646e1e17 100644 (file)
@@ -476,7 +476,7 @@ fn rewrite_args(&self,
             };
 
             let more_items = itemize_list(self.codemap,
-                                          args[min_args-1..].iter(),
+                                          args[min_args - 1..].iter(),
                                           ")",
                                           |arg| span_lo_for_arg(arg),
                                           |arg| arg.ty.span.hi,
index 12eebb7b6918cf73f45d59f479482fc03aff2976..9a169c15ce183a39f0c788bb920e377c9783fba7 100644 (file)
@@ -379,7 +379,7 @@ fn next(&mut self) -> Option<Self::Item> {
                 // because of the way we divide pre- and post- comments.
 
                 // Everything from the separator to the next item.
-                let test_snippet = &post_snippet[comment_end-1..];
+                let test_snippet = &post_snippet[comment_end - 1..];
                 let first_newline = test_snippet.find('\n').unwrap_or(test_snippet.len());
                 // From the end of the first line of comments.
                 let test_snippet = &test_snippet[first_newline..];
index 135e6c3815b159f66e9f38e0092dc57361c1f2a0..5c5565c65969e25acd99ab5c918df42de49c73f5 100644 (file)
@@ -78,7 +78,7 @@ fn write_snippet<F: Fn(&mut FmtVisitor, &str, &str)>(&mut self,
                     self.buffer.push_str(&snippet[line_start..lw]);
                     self.buffer.push_str("\n");
                 } else {
-                    self.buffer.push_str(&snippet[line_start..i+1]);
+                    self.buffer.push_str(&snippet[line_start..i + 1]);
                 }
 
                 line_start = i + 1;
index 883d46a22d43ff8120b09f518c929a85f95580c2..21dc2cde2a5a65cd44fc035cfd1141b45d6a266e 100644 (file)
@@ -407,7 +407,7 @@ fn rewrite(&self, context: &RewriteContext, _: usize, offset: Indent) -> Option<
             let a_str = context.snippet(a.span);
 
             if i > 0 {
-                let comment = context.snippet(codemap::mk_sp(self[i-1].span.hi, a.span.lo));
+                let comment = context.snippet(codemap::mk_sp(self[i - 1].span.hi, a.span.lo));
                 // This particular horror show is to preserve line breaks in between doc
                 // comments. An alternative would be to force such line breaks to start
                 // with the usual doc comment token.