diff --git a/src/visitor.rs b/src/visitor.rs index 762eda2013a..f15c2e07b82 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -326,11 +326,13 @@ impl<'a> FmtVisitor<'a> { // TODO: Should rewrite properly `mod X;` if is_internal { - debug!("FmtVisitor::format_mod: internal mod"); self.block_indent = self.block_indent.block_indent(self.config); visit::walk_mod(self, m); - debug!("... last_pos after: {:?}", self.last_pos); self.block_indent = self.block_indent.block_unindent(self.config); + + self.format_missing_with_indent(m.inner.hi - BytePos(1)); + self.buffer.push_str("}"); + self.last_pos = m.inner.hi; } } diff --git a/tests/source/mod-1.rs b/tests/source/mod-1.rs new file mode 100644 index 00000000000..2efb8f538e5 --- /dev/null +++ b/tests/source/mod-1.rs @@ -0,0 +1,17 @@ +// Deeply indented modules. + + mod foo { mod bar { mod baz {} } } + +mod foo { + mod bar { + mod baz { + fn foo() { bar() } + } + } + + mod qux { + + } +} + +mod boxed { pub use std::boxed::{Box, HEAP}; } diff --git a/tests/target/mod-1.rs b/tests/target/mod-1.rs index c6d5f355f61..8916c972ad1 100644 --- a/tests/target/mod-1.rs +++ b/tests/target/mod-1.rs @@ -1,5 +1,12 @@ // Deeply indented modules. +mod foo { + mod bar { + mod baz { + } + } +} + mod foo { mod bar { mod baz { @@ -13,3 +20,7 @@ mod foo { } } + +mod boxed { + pub use std::boxed::{Box, HEAP}; +}