Is there a tool (possibly rustfmt) that can sort modules with some sort of stable ordering?
Would like to apply that to some generated code (from prost-build in this case)
Conversation
Yes. If your module is an entire file, then that's easy to do. It's a bit more tricky to run it on a sub module. But if you've generated that yourself, I think it's doable
1
We're trying to run a code generator within a GitHub Action, and if the output diverges from what's checked in, automatically open a pull request.
Unfortunately the generated code is nondeterministic so it's opening spurious PRs.
2
1
Do you know why it's non-deterministic? Parallelism?
My best guess is the code generator (which I don't directly control) uses HashMaps which are randomly seeded so as to avoid hashDoS.
If it's simple as that, switching to BTreeMap should fix it, but I wasn't actually clear that was the source of the problem.
1



