rust-lang / libc

Raw bindings to platform APIs for Rust
https://docs.rs/libc
Apache License 2.0
2.1k stars 1.04k forks source link

ci: use some tricks to format macro bodies #4107

Closed tgross35 closed 1 week ago

tgross35 commented 1 week ago

We have a lot of syntax contained within macro bodies, which rustfmt doesn't touch. Add a hack that replaces relevant macro invocations with functions, formats, then resets.

rustbot commented 1 week ago

r? @JohnTitor

rustbot has assigned @JohnTitor. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot commented 1 week ago

Some changes occurred in OpenBSD module

cc @semarie

Some changes occurred in solarish module

cc @jclulow, @pfmooney

tgross35 commented 1 week ago

This still isn't ideal, I really wish rustfmt handled something like this out of the box even if unstable. In any case, this is significantly nicer than just having the majority of this codebase unformatted because everything needs a macro wrapper.

Sorry everyone, conflicts ahead 🚢