Omit newline for empty macro branches

This commit is contained in:
Ingvar Stepanyan 2018-01-25 14:12:18 +00:00
parent 5bd036fcac
commit 9423cdba82
4 changed files with 5 additions and 9 deletions

View File

@ -400,7 +400,7 @@ pub fn rewrite_macro_def(
if has_block_body {
result += new_body.trim();
} else {
} else if !new_body.is_empty() {
result += "\n";
result += &new_body;
result += &mac_indent_str;

View File

@ -1,6 +1,5 @@
macro_rules! test {
($($t: tt)*) => {
};
($($t: tt)*) => {};
}
fn main() {

View File

@ -4,8 +4,7 @@ macro_rules! m {
$func(x)
}};
() => {
};
() => {};
($item: ident) => {
mod macro_item {

View File

@ -141,8 +141,7 @@ fn issue_1555() {
fn issue1178() {
macro_rules! foo {
(#[$attr: meta] $name: ident) => {
};
(#[$attr: meta] $name: ident) => {};
}
foo!(
@ -890,8 +889,7 @@ fn macro_in_pattern_position() {
};
}
macro foo() {
}
macro foo() {}
pub macro bar($x: ident + $y: expr;) {
fn foo($x: Foo) {