Omit newline for empty macro branches
This commit is contained in:
parent
5bd036fcac
commit
9423cdba82
@ -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;
|
||||
|
@ -1,6 +1,5 @@
|
||||
macro_rules! test {
|
||||
($($t: tt)*) => {
|
||||
};
|
||||
($($t: tt)*) => {};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -4,8 +4,7 @@ macro_rules! m {
|
||||
$func(x)
|
||||
}};
|
||||
|
||||
() => {
|
||||
};
|
||||
() => {};
|
||||
|
||||
($item: ident) => {
|
||||
mod macro_item {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user