Reported 5 the idempotency issues, that I found during fuzzing with reproducers upstream: test: add three failing --verify regressions found by fuzzing by Mic92 · Pull Request #386 · NixOS/nixfmt · GitHub
There is now a pull request to get the regressions merged Fix idempotency regressions found on #386 by dyegoaurelio · Pull Request #387 · NixOS/nixfmt · GitHub by @dyegoaurelio
What was the reason not to use rnix-parser? It seems pretty good at what its doing and provides itself a rust library. I wonder where the gaps are that you encountered.
Main one was to make sure I can make it compatible with the Haskell code base. For instance nixfmt has custom directives now in comments and it assigns whitespace to ast nodes in a very certain way. I might have end up with a fork of the parser anyway.
Also I wanted to try using a hand-written parser to have full control over error messages and potentially also to optimise it beyond what a framework allows. For example being able to detect if someone used a comma as a list operator (common issue if you are new or not so new to Nix)