Automatically format all Rust files in a project with a single cargo fmt command before every commit.
Add a CI check that fails a pull request immediately if any submitted code is not correctly formatted.
Configure rustfmt.toml to enforce a custom line length or indentation style across an entire team.
Install an editor plugin so Rust code formats automatically every time a file is saved.
| rust-lang/rustfmt | facebook/sapling | openethereum/parity-ethereum | |
|---|---|---|---|
| Stars | 6,827 | 6,835 | 6,837 |
| Language | Rust | Rust | Rust |
| Setup difficulty | easy | moderate | hard |
| Complexity | 2/5 | 3/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Some advanced configuration options are only available when using the nightly Rust build rather than the stable release.
Rustfmt is the official code formatter for the Rust programming language. Its job is to automatically rewrite your Rust source files so they follow a consistent style, the same way you might use a spell-checker to clean up text. Developers run it before committing code so that everyone on a project writes code that looks the same, regardless of personal habits. The most common way to use it is through the Rust build tool: running cargo fmt in your project directory formats all the code in that project in one step. You can also run rustfmt directly on individual files, or pipe code through it on the command line. There are editor plugins for Vim, Emacs, Sublime Text, VS Code, IntelliJ, and others, so it can run automatically whenever you save a file. For teams, rustfmt has a check mode that exits with an error if any code is not formatted correctly, without changing anything. This is used in automated testing pipelines so that a pull request fails immediately if it contains unformatted code, keeping the whole codebase consistent without relying on people to remember to run the formatter manually. The tool is configurable through a file called rustfmt.toml in your project. You can adjust things like indentation, line length, and other style details. Some options are only available when using the nightly build of Rust rather than the stable release. By default, rustfmt follows the official Rust style guide. The project is open source and maintained by the Rust language team.
Official code formatter for the Rust programming language that automatically rewrites Rust source files to follow a consistent style. Run it before commits or wire it into CI to keep an entire codebase looking the same.
Mainly Rust. The stack also includes Rust, cargo.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.