Re: [PATCH 2/6] ci: check formatting of our Rust code
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 7, 2025, 13:04 UTC
- Message-ID
- <CAOLa=ZT8TDiA=1cAsnS6RkHL-5J2+3YBorBjKsKWm38oaXt0Fg@mail.gmail.com>
- In-Reply-To
- <20251007-b4-pks-ci-rust-v1-2-394502abe7ea@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 18 quoted lines
> Introduce a CI check that verifies that our Rust code is well-formatted. > This check uses rustfmt(1), which is the de-facto standard in the Rust > world. > > The rustfmt(1) tool allows to tweak the final format in theory. In > practice though, the Rust ecosystem has aligned on style "editions". > These editions only exist to ensure that any potential changes to the > style don't cause reformats to existing code bases. Other than that, > most Rust projects out there accept this default style of a specific > edition. > > Let's do the same and use that default style. It may not be anyone's > favorite, but it is consistent and by making it part of our CI we also > enforce it right from the start. > > Note that we don't have to pick a specific style edition here, as the > edition is automatically derived from the edition we have specified in > our "Cargo.toml" file.
One small nit: We should mention that `cargo fmt` is simply a wrapper around `rustfmt`, which also handles file discovery.