From 84718b5b90221597204de9f010d3079f91f7b9f3 Mon Sep 17 00:00:00 2001 From: Marcus Klaas Date: Fri, 2 Oct 2015 11:48:52 +0200 Subject: [PATCH] Format rustfmt's own indices --- src/expr.rs | 4 ++-- src/items.rs | 2 +- src/lists.rs | 2 +- src/missed_spans.rs | 2 +- src/visitor.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index 75630eb8301..b68cbb87580 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -756,7 +756,7 @@ fn rewrite_match_arm_comment(context: &RewriteContext, -> Option { // 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, diff --git a/src/items.rs b/src/items.rs index e6a334d9ad3..827b528771e 100644 --- a/src/items.rs +++ b/src/items.rs @@ -476,7 +476,7 @@ impl<'a> FmtVisitor<'a> { }; 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, diff --git a/src/lists.rs b/src/lists.rs index 12eebb7b691..9a169c15ce1 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -379,7 +379,7 @@ impl<'a, T, I, F1, F2, F3> Iterator for ListItems<'a, I, F1, F2, F3> // 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..]; diff --git a/src/missed_spans.rs b/src/missed_spans.rs index 135e6c3815b..5c5565c6596 100644 --- a/src/missed_spans.rs +++ b/src/missed_spans.rs @@ -78,7 +78,7 @@ impl<'a> FmtVisitor<'a> { 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; diff --git a/src/visitor.rs b/src/visitor.rs index 883d46a22d4..21dc2cde2a5 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -407,7 +407,7 @@ impl<'a> Rewrite for [ast::Attribute] { 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.