Check formatting via rustfmt. Configuration is kept rusty, instead of mimicking clang-format.
During development, cargo +nightly fmt should be used to wrap comments, strings, group imports, etc. As these features are unstable and might have false-positives, we don't enforce on them in the CI yet.
Stable rustfmt currently doesn't enforce line length limits strictly, therefore we have to verify length outselves. We skip length limits that are fixed by rustfmt, however, the current approach leaves some false positives:
- If two lines within one rustfmt diff exceed the limit,
- one of them is fixed by rustfmt,
- then for *both* will be issued a warning.
Since this both doesn't occur too often, and also should be fixed by the "recommended" (aka cargo +nightly fmt) approach, the trade-off of having a simple implementation seems worth it.
Also, if cargo fmt wraps more and more code successfully, these false positives should disappear.