Use the block_indent inside visit_expr.

This seems to pass all the tests and greatly improves the formatting output
when using hard tabs.
This commit is contained in:
Pavel Sountsov 2015-09-18 23:57:27 -07:00 committed by SiegeLord
parent 03e1b27826
commit 620650219e

View file

@ -39,12 +39,9 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
self.codemap.lookup_char_pos(ex.span.hi));
self.format_missing(ex.span.lo);
let offset = self.buffer.cur_offset();
// FIXME: We put the entire offset into the block_indent, which might not be correct in all
// situations.
let rewrite = ex.rewrite(&self.get_context(),
self.config.max_width - offset,
Indent::new(offset, 0));
self.config.max_width - self.block_indent.width(),
self.block_indent);
if let Some(new_str) = rewrite {
self.buffer.push_str(&new_str);