# rustfmt

> A tool for formatting Rust code according to style guidelines

Source: https://talira.ai/catalog/rustfmt-r30f7ns1
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / formatting](https://talira.ai/categories/developer-tools/formatting), [languages / rust](https://talira.ai/categories/languages/rust)
- Platforms: linux, macos, windows[^2]
- Licence: MIT OR Apache-2.0[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Self-hostable: yes[^2]
- Backed by: [The Rust Project](https://talira.ai/orgs/rust-project.md)

rustfmt is the official formatter for [Rust](https://talira.ai/catalog/rust-mf51vs5t.md) code, formatting it to the Rust style guidelines. It ships as a rustup component (`rustup component add rustfmt`) and runs on a whole project through [Cargo](https://talira.ai/catalog/cargo-n4s7zm2g.md) with `cargo fmt`, or on files with `rustfmt`; `--check` exits non-zero when code isn't formatted, for CI and pre-commit hooks. A `rustfmt.toml` file in the project configures options such as line width and import grouping, some of them only on the nightly toolchain. Plugins run it from Vim, Emacs, VS Code and other editors. It's dual-licensed MIT or Apache-2.0.

## Links

- GitHub: https://github.com/rust-lang/rustfmt
- Docs: https://rust-lang.github.io/rustfmt/

## Problems it solves

- format Rust code consistently across a team
- fail CI when a pull request contains unformatted Rust code
- format a whole Cargo workspace with one command
- configure line width and import ordering for Rust formatting
- format Rust on save in my editor

## Features

- formats Rust code to the style guidelines
- cargo fmt for whole projects and workspaces
- --check mode for CI
- rustfmt.toml or .rustfmt.toml configuration
- stable and nightly toolchain components
- editor integrations for Vim, Emacs, VS Code and others

## Limitations

- Code that doesn't parse, macro declarations and uses, and comments are formatted only partly or not at all

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.32 out of 1.
Signals: backing 0.30, extensibility 0.20.

- backed by The Rust Project

Warnings:

- GitHub activity not fetched yet

## Related

- Works with [Cargo](https://talira.ai/catalog/cargo-n4s7zm2g.md)

## Alternatives

- [Prettier](https://talira.ai/catalog/prettier-wqw3mymz.md): An opinionated code formatter that reprints your code in one consistent style
- [Ormolu](https://talira.ai/catalog/ormolu-6ed3km1p.md): A formatter for Haskell source code

## Sources

[^1]: https://github.com/rust-lang/rustfmt#license (checked 24 Nov 2026)
[^2]: https://github.com/rust-lang/rustfmt (checked 24 Nov 2026)
