Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should strip whitespace-only lines from macros #2721

Closed
nrc opened this issue May 18, 2018 · 0 comments
Closed

Should strip whitespace-only lines from macros #2721

nrc opened this issue May 18, 2018 · 0 comments
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. poor-formatting

Comments

@nrc
Copy link
Member

nrc commented May 18, 2018

Either we should change a whitespace-only line to an empty line, or the line should be marked as unformatted.

E.g. (from rand, src/lib.rs, causing an integration test failue),

macro_rules! impl_as_byte_slice_arrays {
    ($n:expr,) => {};
    ($n:expr, $N:ident, $($NN:ident,)*) => {
        impl_as_byte_slice_arrays!($n - 1, $($NN,)*);
        
        impl<T> AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut {
            fn as_byte_slice_mut(&mut self) -> &mut [u8] {
                self[..].as_byte_slice_mut()
            }

            fn to_le(&mut self) {
                self[..].to_le()
            }
        }
    };
    (!div $n:expr,) => {};
    (!div $n:expr, $N:ident, $($NN:ident,)*) => {
        impl_as_byte_slice_arrays!(!div $n / 2, $($NN,)*);

        impl<T> AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut {
            fn as_byte_slice_mut(&mut self) -> &mut [u8] {
                self[..].as_byte_slice_mut()
            }
            
            fn to_le(&mut self) {
                self[..].to_le()
            }
        }
    };
}
@nrc nrc added bug Panic, non-idempotency, invalid code, etc. a-macros labels May 18, 2018
@nrc nrc added this to the 1.0 milestone May 18, 2018
@nrc nrc added poor-formatting bug Panic, non-idempotency, invalid code, etc. and removed bug Panic, non-idempotency, invalid code, etc. labels Jun 19, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Jul 1, 2018
@nrc nrc closed this as completed in #2821 Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. poor-formatting
Projects
None yet
Development

No branches or pull requests

1 participant