mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
parent
fb17a44584
commit
a0e85f9a5f
@ -454,11 +454,19 @@ impl<'a> FmtVisitor<'a> {
|
|||||||
|
|
||||||
if is_internal {
|
if is_internal {
|
||||||
self.buffer.push_str(" {");
|
self.buffer.push_str(" {");
|
||||||
self.last_pos = ::utils::span_after(s, "{", self.codemap);
|
// Hackery to account for the closing }.
|
||||||
self.block_indent = self.block_indent.block_indent(self.config);
|
let mod_lo = ::utils::span_after(s, "{", self.codemap);
|
||||||
self.walk_mod_items(m);
|
let body_snippet = self.snippet(codemap::mk_sp(mod_lo, m.inner.hi - BytePos(1)));
|
||||||
self.format_missing_with_indent(m.inner.hi - BytePos(1));
|
let body_snippet = body_snippet.trim();
|
||||||
self.close_block();
|
if body_snippet.is_empty() {
|
||||||
|
self.buffer.push_str("}");
|
||||||
|
} else {
|
||||||
|
self.last_pos = mod_lo;
|
||||||
|
self.block_indent = self.block_indent.block_indent(self.config);
|
||||||
|
self.walk_mod_items(m);
|
||||||
|
self.format_missing_with_indent(m.inner.hi - BytePos(1));
|
||||||
|
self.close_block();
|
||||||
|
}
|
||||||
self.last_pos = m.inner.hi;
|
self.last_pos = m.inner.hi;
|
||||||
} else {
|
} else {
|
||||||
self.buffer.push_str(";");
|
self.buffer.push_str(";");
|
||||||
|
@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
/// This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly
|
/// This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly
|
||||||
/// and justly.
|
/// and justly.
|
||||||
pub mod foo {
|
pub mod foo {}
|
||||||
}
|
|
||||||
|
@ -3,5 +3,4 @@
|
|||||||
//! This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly
|
//! This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly
|
||||||
//! and justly.
|
//! and justly.
|
||||||
|
|
||||||
pub mod foo {
|
pub mod foo {}
|
||||||
}
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
mod bar {
|
mod bar {
|
||||||
mod baz {
|
mod baz {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,9 +15,7 @@ mod foo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod qux {
|
mod qux {}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod boxed {
|
mod boxed {
|
||||||
|
Loading…
Reference in New Issue
Block a user