]> git.lizzy.rs Git - rust.git/commitdiff
Remove old heuristics from legacy style
authorSeiichi Uchida <seuchida@gmail.com>
Wed, 19 Jul 2017 15:16:31 +0000 (00:16 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Wed, 19 Jul 2017 15:42:00 +0000 (00:42 +0900)
src/expr.rs
src/visitor.rs

index 14bf46e966f37dbebddd513404375d82596db9a6..c2205f4ea747a5882d5ad523c2b11e5e37679344 100644 (file)
@@ -876,14 +876,7 @@ fn rewrite_block_with_visitor(
     }
 
     visitor.visit_block(block);
-    if visitor.failed && shape.indent.alignment != 0 {
-        block.rewrite(
-            context,
-            Shape::indented(shape.indent.block_only(), context.config),
-        )
-    } else {
-        Some(format!("{}{}", prefix, visitor.buffer))
-    }
+    Some(format!("{}{}", prefix, visitor.buffer))
 }
 
 impl Rewrite for ast::Block {
@@ -2075,23 +2068,7 @@ pub fn rewrite_call_inner<'a, T>(
         one_line_width,
         args_max_width,
         force_trailing_comma,
-    ).or_else(|| if context.use_block_indent() {
-        rewrite_call_args(
-            context,
-            args,
-            args_span,
-            Shape::indented(
-                shape.block().indent.block_indent(context.config),
-                context.config,
-            ),
-            0,
-            0,
-            force_trailing_comma,
-        )
-    } else {
-        None
-    })
-        .ok_or(Ordering::Less)?;
+    ).ok_or(Ordering::Less)?;
 
     if !context.use_block_indent() && need_block_indent(&list_str, nested_shape) && !extendable {
         let mut new_context = context.clone();
index 2a6a827c1a4b726b928fa8b44a0c92d2f3697c4e..9ee7136bb63e895f9b8d42a516bd92962f20e377 100644 (file)
@@ -56,7 +56,6 @@ pub struct FmtVisitor<'a> {
     // FIXME: use an RAII util or closure for indenting
     pub block_indent: Indent,
     pub config: &'a Config,
-    pub failed: bool,
     pub is_if_else_block: bool,
 }
 
@@ -558,18 +557,6 @@ fn visit_mac(&mut self, mac: &ast::Mac, ident: Option<ast::Ident>, pos: MacroPos
 
     fn push_rewrite(&mut self, span: Span, rewrite: Option<String>) {
         self.format_missing_with_indent(source!(self, span).lo);
-        self.failed = match rewrite {
-            Some(ref s)
-                if s.rewrite(
-                    &self.get_context(),
-                    Shape::indented(self.block_indent, self.config),
-                ).is_none() =>
-            {
-                true
-            }
-            None => true,
-            _ => self.failed,
-        };
         let result = rewrite.unwrap_or_else(|| self.snippet(span));
         self.buffer.push_str(&result);
         self.last_pos = source!(self, span).hi;
@@ -583,7 +570,6 @@ pub fn from_codemap(parse_session: &'a ParseSess, config: &'a Config) -> FmtVisi
             last_pos: BytePos(0),
             block_indent: Indent::empty(),
             config: config,
-            failed: false,
             is_if_else_block: false,
         }
     }