]> git.lizzy.rs Git - rust.git/blobdiff - src/visitor.rs
Remove BlockIndentStyle::Inherit
[rust.git] / src / visitor.rs
index e7fd3beda2f98de9f88bae47e886e5ce32b6c0d3..2700287608de6f1944a3648c4f0fcdd5367fb476 100644 (file)
@@ -21,7 +21,8 @@
 use rewrite::{Rewrite, RewriteContext};
 use comment::rewrite_comment;
 use macros::{rewrite_macro, MacroPosition};
-use items::{rewrite_static, rewrite_associated_type, rewrite_type_alias, format_impl, format_trait};
+use items::{rewrite_static, rewrite_associated_type, rewrite_associated_impl_type,
+            rewrite_type_alias, format_impl, format_trait};
 
 fn is_use_item(item: &ast::Item) -> bool {
     match item.node {
@@ -264,10 +265,10 @@ pub fn visit_item(&mut self, item: &ast::Item) {
                                            item.span,
                                            indent,
                                            None)
-                        .map(|s| match *def {
-                            ast::VariantData::Tuple(..) => s + ";",
-                            _ => s,
-                        })
+                            .map(|s| match *def {
+                                     ast::VariantData::Tuple(..) => s + ";",
+                                     _ => s,
+                                 })
                 };
                 self.push_rewrite(item.span, rewrite);
             }
@@ -411,11 +412,12 @@ pub fn visit_impl_item(&mut self, ii: &ast::ImplItem) {
                 self.push_rewrite(ii.span, rewrite);
             }
             ast::ImplItemKind::Type(ref ty) => {
-                let rewrite = rewrite_associated_type(ii.ident,
-                                                      Some(ty),
-                                                      None,
-                                                      &self.get_context(),
-                                                      self.block_indent);
+                let rewrite = rewrite_associated_impl_type(ii.ident,
+                                                           ii.defaultness,
+                                                           Some(ty),
+                                                           None,
+                                                           &self.get_context(),
+                                                           self.block_indent);
                 self.push_rewrite(ii.span, rewrite);
             }
             ast::ImplItemKind::Macro(ref mac) => {
@@ -486,8 +488,9 @@ pub fn visit_attrs(&mut self, attrs: &[ast::Attribute]) -> bool {
         self.format_missing_with_indent(source!(self, first.span).lo);
 
         let rewrite = outers.rewrite(&self.get_context(),
-                     Shape::legacy(self.config.max_width - self.block_indent.width(),
-                                   self.block_indent))
+                                     Shape::legacy(self.config.max_width -
+                                                   self.block_indent.width(),
+                                                   self.block_indent))
             .unwrap();
         self.buffer.push_str(&rewrite);
         let last = outers.last().unwrap();
@@ -591,7 +594,7 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
                     let comment = try_opt!(rewrite_comment(comment,
                                                            false,
                                                            Shape::legacy(context.config
-                                                                             .ideal_width -
+                                                                             .comment_width -
                                                                          shape.indent.width(),
                                                                          shape.indent),
                                                            context.config));
@@ -607,7 +610,7 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
             if a_str.starts_with("//") {
                 a_str = try_opt!(rewrite_comment(&a_str,
                                                  false,
-                                                 Shape::legacy(context.config.ideal_width -
+                                                 Shape::legacy(context.config.comment_width -
                                                                shape.indent.width(),
                                                                shape.indent),
                                                  context.config));