about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2015-11-23 13:58:19 +1300
committerNick Cameron <nrc@ncameron.org>2015-11-23 13:58:19 +1300
commit40eb3ea8570511b4b5e85f3ffecf9b74957a14dd (patch)
tree350a9630b8b0bac5a0c780e8943b3fa56488c606 /src
parent08e6e74e693803dfa4e9fb5ad0daa2516362a3df (diff)
parent4b4dd170d809c24fb308ea1bf81b91541a5b8b01 (diff)
Merge pull request #641 from marcusklaas/fix-doc-commentz
Correct doc comment indentation for struct fields
Diffstat (limited to 'src')
-rw-r--r--src/items.rs7
-rw-r--r--src/lists.rs8
2 files changed, 4 insertions, 11 deletions
diff --git a/src/items.rs b/src/items.rs
index bbe51c73c40..46a90935071 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -653,15 +653,14 @@ impl Rewrite for ast::StructField {
             ast::StructFieldKind::NamedField(_, vis) |
             ast::StructFieldKind::UnnamedField(vis) => format_visibility(vis),
         };
-        let indent = context.block_indent.block_indent(context.config);
         let mut attr_str = try_opt!(self.node
                                         .attrs
                                         .rewrite(context,
-                                                 context.config.max_width - indent.width(),
-                                                 indent));
+                                                 context.config.max_width - offset.width(),
+                                                 offset));
         if !attr_str.is_empty() {
             attr_str.push('\n');
-            attr_str.push_str(&indent.to_string(context.config));
+            attr_str.push_str(&offset.to_string(context.config));
         }
 
         let result = match name {
diff --git a/src/lists.rs b/src/lists.rs
index ecde4f19fe4..5bd2845c0e5 100644
--- a/src/lists.rs
+++ b/src/lists.rs
@@ -14,7 +14,6 @@ use std::iter::Peekable;
 use syntax::codemap::{self, CodeMap, BytePos};
 
 use Indent;
-use utils::wrap_str;
 use comment::{FindUncommented, rewrite_comment, find_comment_end};
 use config::Config;
 
@@ -280,12 +279,7 @@ pub fn write_list<'b, I, T>(items: I, formatting: &ListFormatting<'b>) -> Option
             }
         }
 
-        // Make sure that string actually fits.
-        let item_str = try_opt!(wrap_str(&inner_item[..],
-                                         formatting.config.max_width,
-                                         formatting.width,
-                                         formatting.indent));
-        result.push_str(&item_str);
+        result.push_str(&inner_item[..]);
 
         // Post-comments
         if tactic != DefinitiveListTactic::Vertical && item.post_comment.is_some() {