Merge pull request #334 from marcusklaas/sparse-mods
Place the closing brace of an inline mod on a new line
This commit is contained in:
commit
fa67e0359a
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
17
tests/source/mod-1.rs
Normal file
17
tests/source/mod-1.rs
Normal file
@ -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}; }
|
@ -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};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user