about summary refs log tree commit diff
path: root/src/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr.rs')
-rw-r--r--src/expr.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/expr.rs b/src/expr.rs
index b69989aa761..f0a877db215 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -423,7 +423,7 @@ impl Rewrite for ast::Block {
         }
 
         let mut visitor = FmtVisitor::from_codemap(context.codemap, context.config);
-        visitor.block_indent = context.block_indent + context.overflow_indent;
+        visitor.block_indent = context.block_indent;
 
         let prefix = match self.rules {
             ast::BlockCheckMode::UnsafeBlock(..) => {
@@ -471,10 +471,6 @@ impl Rewrite for ast::Block {
 
         visitor.visit_block(self);
 
-        // Push text between last block item and end of block
-        let snippet = visitor.snippet(mk_sp(visitor.last_pos, self.span.hi));
-        visitor.buffer.push_str(&snippet);
-
         Some(format!("{}{}", prefix, visitor.buffer))
     }
 }
@@ -751,7 +747,7 @@ fn rewrite_match(context: &RewriteContext,
     let mut result = format!("match {} {{", cond_str);
 
     let nested_context = context.nested_context();
-    let arm_indent = nested_context.block_indent + context.overflow_indent;
+    let arm_indent = nested_context.block_indent;
     let arm_indent_str = arm_indent.to_string(context.config);
 
     let open_brace_pos = span_after(mk_sp(cond.span.hi, arm_start_pos(&arms[0])),
@@ -795,7 +791,7 @@ fn rewrite_match(context: &RewriteContext,
                                                      &arm_indent_str));
     result.push_str(&comment);
     result.push('\n');
-    result.push_str(&(context.block_indent + context.overflow_indent).to_string(context.config));
+    result.push_str(&context.block_indent.to_string(context.config));
     result.push('}');
     Some(result)
 }
@@ -1534,12 +1530,11 @@ pub fn rewrite_assign_rhs<S: Into<String>>(context: &RewriteContext,
             let new_offset = offset.block_indent(context.config);
             result.push_str(&format!("\n{}", new_offset.to_string(context.config)));
 
-            // FIXME: we probably should related max_width to width instead of config.max_width
-            // where is the 1 coming from anyway?
+            // FIXME: we probably should related max_width to width instead of
+            // config.max_width where is the 1 coming from anyway?
             let max_width = try_opt!(context.config.max_width.checked_sub(new_offset.width() + 1));
-            let rhs_indent = Indent::new(context.config.tab_spaces, 0);
-            let overflow_context = context.overflow_context(rhs_indent);
-            let rhs = ex.rewrite(&overflow_context, max_width, new_offset);
+            let inner_context = context.nested_context();
+            let rhs = ex.rewrite(&inner_context, max_width, new_offset);
 
             result.push_str(&&try_opt!(rhs));
         }