diff --git a/src/macros.rs b/src/macros.rs index d378bb8ffb1..43f3071b70a 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1347,7 +1347,7 @@ impl MacroBranch { .fold( (String::new(), true), |(mut s, need_indent), (i, (kind, ref l))| { - if !l.is_empty() + if !is_empty_line(l) && need_indent && !new_body_snippet.is_line_non_formatted(i + 1) { diff --git a/tests/target/issue-2810.rs b/tests/target/issue-2810.rs new file mode 100644 index 00000000000..34140c7a1fc --- /dev/null +++ b/tests/target/issue-2810.rs @@ -0,0 +1,14 @@ +// rustfmt-newline_style: Windows + +#[macro_export] +macro_rules! hmmm___ffi_error { + ($result:ident) => { + pub struct $result { + success: bool, + } + + impl $result { + pub fn foo(self) {} + } + }; +}