Checking sorting of #[cfg(target_os =

For the nix crate we have a lot of platform-specific code sprinkled about and a ton of #[cfg(any(target_os = ..., ...))] sprinkles about. These are easiest to maintain if the OSes are listed alphabetically and I’d like to enforce that during our testing. I don’t see any such checks available from rustc or Clippy, but I’m sure some project has this solved already, though this is rather hard to search GitHub or online for. Does anyone know of any projects doing tests that check this?


This could be a nice thing to add to rustfmt.

1 Like

I think that’s a perfect place for such functionality. I’ll file an issue for it. Thanks!