A tool for formatting Rust code according to the official Rust style guidelines.
rustfmt is the official code formatting tool for the Rust programming language. It automatically formats Rust source code to comply with the community's style guidelines, ensuring consistent code appearance across projects. It solves the problem of manual formatting and style debates by providing a standardized, automated solution.
Rust developers and teams who want to maintain consistent code style in their projects, particularly those working on collaborative codebases or open-source Rust projects.
Developers choose rustfmt because it's the official, community-backed formatter that integrates seamlessly with Rust's toolchain (via `cargo fmt`). Its configuration options and stability guarantees make it reliable for long-term projects, while its editor integrations provide a smooth developer experience.
Format Rust code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Backed by Rust's RFC process, ensuring formatting aligns with the official Rust style guide, which reduces style debates and fosters ecosystem consistency.
Integrates directly with Cargo via `cargo fmt`, allowing easy formatting of entire projects or workspaces without manual file handling.
The `--check` flag enables integration into CI pipelines to fail builds on unformatted code, as documented in the Travis CI example.
Works with popular editors like VS Code, IntelliJ, and Vim through plugins, providing a smooth in-editor formatting experience.
Does not format all macro declarations and uses, as admitted in the limitations section, which can leave parts of macro-heavy codebases unformatted.
Explicitly does not format comments, leading to potential inconsistencies in documentation style that require manual adjustment.
Requires manual configuration of `edition` and `style_edition` in `rustfmt.toml` to avoid inconsistencies between `cargo fmt` and `rustfmt`, as warned in the tips section.