]> git.lizzy.rs Git - rust.git/blobdiff - src/lists.rs
Merge pull request #3035 from topecongiro/issue-3006
[rust.git] / src / lists.rs
index 49548cc26a318ffb8055f8cb4e6c791e31e3cd8d..f1b01ea8055f84046cc77e72365a8b8994f4a42c 100644 (file)
@@ -14,7 +14,7 @@
 use std::iter::Peekable;
 
 use config::lists::*;
-use syntax::codemap::BytePos;
+use syntax::source_map::BytePos;
 
 use comment::{find_comment_end, rewrite_comment, FindUncommented};
 use config::{Config, IndentStyle};
@@ -209,8 +209,8 @@ pub enum Separator {
 }
 
 impl Separator {
-    pub fn len(&self) -> usize {
-        match *self {
+    pub fn len(self) -> usize {
+        match self {
             // 2 = `, `
             Separator::Comma => 2,
             // 3 = ` | `
@@ -475,7 +475,7 @@ pub fn write_list<I, T>(items: I, formatting: &ListFormatting) -> Option<String>
                     formatted_comment = rewrite_post_comment(&mut item_max_width)?;
                     comment_alignment = post_comment_alignment(item_max_width, inner_item.len());
                 }
-                for _ in 0..(comment_alignment + 1) {
+                for _ in 0..=comment_alignment {
                     result.push(' ');
                 }
                 // An additional space for the missing trailing separator.