]> git.lizzy.rs Git - rust.git/blobdiff - src/lists.rs
Merge pull request #3035 from topecongiro/issue-3006
[rust.git] / src / lists.rs
index 9b65fdbd1da75c8b6044e3253afa2f04012e17f0..f1b01ea8055f84046cc77e72365a8b8994f4a42c 100644 (file)
@@ -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.