Skip to content

Commit 3dadcf5

Browse files
SiegeLordExSiegeLord
authored andcommitted
Use the block_indent inside visit_expr.
This seems to pass all the tests and greatly improves the formatting output when using hard tabs.
1 parent f51ee1c commit 3dadcf5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/visitor.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
3939
self.codemap.lookup_char_pos(ex.span.hi));
4040
self.format_missing(ex.span.lo);
4141

42-
let offset = self.buffer.cur_offset();
43-
// FIXME: We put the entire offset into the block_indent, which might not be correct in all
44-
// situations.
4542
let rewrite = ex.rewrite(&self.get_context(),
46-
self.config.max_width - offset,
47-
Indent::new(offset, 0));
43+
self.config.max_width - self.block_indent.width(),
44+
self.block_indent);
4845

4946
if let Some(new_str) = rewrite {
5047
self.buffer.push_str(&new_str);

0 commit comments

Comments
 (0)