[Chronik] Add rustfmt linter, to style check Rust files
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.
- arc lint displays four errors, one being a false positive in line 12.
- arc lint will have only fit the spaces after struct.
- cargo +nightly fmt fixes all errors except the line having way too many x's.
Reviewers: Fabien, #bitcoin_abc
Reviewed By: Fabien, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D11671