A tool for formatting Rust code according to official style guidelines.
rustfmt is the official code formatting tool for the Rust programming language. It automatically reformats 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 across their projects, especially those working on large codebases or open-source libraries where style consistency is important.
Developers choose rustfmt because it's the official, community-backed formatter that integrates seamlessly with Rust's toolchain (via `cargo fmt`). Its configurability and stability guarantees make it reliable for long-term projects, while its editor and CI integrations streamline development workflows.
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.
Formats code according to the official Rust style guide and RFCs, ensuring consistency across the Rust ecosystem as highlighted in the README.
Integrates directly with cargo via 'cargo fmt' and installs with rustup, making it easy to adopt in any Rust project.
Highly configurable through rustfmt.toml files with both stable and unstable options, allowing customization per project needs.
Includes a --check flag for verifying formatting in CI pipelines, enabling automated style enforcement in pull requests.
The README admits that macro declarations and uses are only partially formatted, which can lead to inconsistent formatting in macro-heavy code.
Rustfmt does not format comments, leaving comment layout unchanged and potentially reducing code readability without manual intervention.
Access to unstable formatting options and latest improvements requires the nightly Rust toolchain, adding complexity and potential instability.
Defaults for edition and style_edition differ between rustfmt and cargo fmt, risking formatting differences if not explicitly set in rustfmt.toml.