Config readability and current dependency on cfg_aliases
I'm still working on getting a sense of all of the dependencies in this package to see where some opportunities arise in reducing the dependency set and I came across the dependency we have on cfg_aliases though the nix project. It is used extensively in that project because of the platform specific nature of their code and the many cfg statements.
We have a similar setup where for example in the stty package we have this all over the place:
#[cfg(not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
)))]
As the reader of the code for me its not immediately apparent when reading this why this statement is included all over the place and being unfamiliar with dragonfly I was unaware that the detail shared with all of these platforms is that they are BSD.
The way this dependency works is that you define in the build.rs something like:
cfg_aliases! {
bsd_platform: { any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")) },
}
and then in the code itself you use:
#[cfg(not(bsd_platform)))]
The onboarding to do something like this isn't that difficult but wanted to first see if this was something the maintainers were interested in doing?
I agree with it because it makes .rs easy to patch or sed too.
But they will be removed after we switched to rustix from nix soon. No?