Skip to content

X0027 rustfmt-unformatted

Rule: Every Rust file is formatted the way cargo fmt writes it.

Code X0027 (stable, never reused)
Id rustfmt-unformatted
Category rustfmt
Source rustfmt (run as an executable)
Fix by hand
Needs rustfmt installed

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

One formatting for the whole workspace keeps diffs about the change, not about the layout. rustfmt formats by the project's rustfmt.toml (or its defaults); this lint reports files it would change.

How to fix

Run cargo fmt --all. Code that must keep its layout (a table of numbers) gets #[rustfmt::skip].

Configure

[lints.rustfmt-unformatted]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(rustfmt-unformatted) <reason> (waivers); the code works there too, as in [lints.X0027].