]> git.lizzy.rs Git - rust.git/blobdiff - src/visitor.rs
Merge pull request #128 from marcusklaas/subexpr
[rust.git] / src / visitor.rs
index ed5a5f5da1b774198dc899873cdef3cf35127ada..1b1fd9d17c64a13bd34039a327a47be94e3d569a 100644 (file)
@@ -38,7 +38,9 @@ fn visit_expr(&mut self, ex: &'v ast::Expr) {
                self.codemap.lookup_char_pos(ex.span.hi));
         self.format_missing(ex.span.lo);
         let offset = self.changes.cur_offset_span(ex.span);
-        let context = RewriteContext { codemap: self.codemap, config: self.config };
+        let context = RewriteContext { codemap: self.codemap,
+                                       config: self.config,
+                                       block_indent: self.block_indent, };
         let rewrite = ex.rewrite(&context, self.config.max_width - offset, offset);
 
         if let Some(new_str) = rewrite {
@@ -282,13 +284,11 @@ fn visit_mod(&mut self, m: &'v ast::Mod, s: Span, _: ast::NodeId) {
 
 impl<'a> FmtVisitor<'a> {
     pub fn from_codemap<'b>(codemap: &'b CodeMap, config: &'b Config) -> FmtVisitor<'b> {
-        FmtVisitor {
-            codemap: codemap,
-            changes: ChangeSet::from_codemap(codemap),
-            last_pos: BytePos(0),
-            block_indent: 0,
-            config: config
-        }
+        FmtVisitor { codemap: codemap,
+                     changes: ChangeSet::from_codemap(codemap),
+                     last_pos: BytePos(0),
+                     block_indent: 0,
+                     config: config, }
     }
 
     pub fn snippet(&self, span: Span) -> String {