FREEDOM251

Freedom251 › Code Formatting Tools

rustfmt

Free plan LinuxMacWindows

Visit rustfmt Alternatives Pricing

rustfmt's own site

What rustfmt is

rustfmt formats Rust code according to style guidelines. It works on Linux, macOS, and Windows, and can format files in place or read code from standard input and send formatted code to standard output. With Cargo, `cargo fmt` formats a crate’s binary and library targets and supports Cargo workspaces. Configuration belongs in `rustfmt.toml` or `.rustfmt.toml`; stable settings are available, while unstable settings require opting in on a nightly toolchain. For checks, `--check` returns code 0 when formatting is already in place and 1 when changes are needed, making it suitable for CI checks. The README lists integrations for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, IntelliJ, and CLion. Rustfmt is free and open source under the MIT License and Apache License 2.0. Note that it does not try to format comments, and its listed limitations also include some macro cases, unparsable code, code fragments, non-ASCII Unicode, and bugs. The README says it runs with Rust 1.24 and above, while the latest version requires nightly.

Who it suits

Rust developers who want consistent formatting from Cargo, a command line, an editor, or CI can use rustfmt. Its nightly-only unstable options may suit users who need configuration beyond stable settings.

What it does well

  • Formats Cargo targets across workspaces
  • Reads from stdin and writes to stdout
  • Integrations listed for several editors
  • CI check mode reports formatting differences
  • Free and open source under two licenses

What to know first

  • Does not attempt to format comments
  • Some macro cases are limited
  • Unstable options require nightly and opt-in
  • Latest version requires nightly

Limits

Unstable configuration options require a nightly toolchain and opt-in. The README says the latest version requires nightly.

Plans

PlanBilled and limitsPrice
rustfmtNo paid plans statedFree

As rust-lang.github.io lists them, read 3 Oct 2026. The maker's own page has the final word.

Getting started

  1. Install rustfmt on the stable toolchain with `rustup component add rustfmt`.
  2. Run `cargo fmt` to format crate targets or a Cargo workspace.
  3. Use the rustfmt binary directly for files or standard input and output.
  4. Add configuration in `rustfmt.toml` or `.rustfmt.toml` if needed.
  5. Use `--check` for automated formatting checks. Use nightly and opt in for unstable settings.

Verdict

rustfmt covers common Rust formatting workflows, including Cargo, editor use, and CI. Keep its comment and macro limitations in mind, and check the toolchain requirement for the version and options you need.

Questions

How much does rustfmt cost?

The listed plan is free, with no paid plans stated.

Which platforms does rustfmt support?

It supports Windows, macOS, and Linux.

How do I install rustfmt?

The README says to install it on the stable toolchain with `rustup component add rustfmt`.

Can rustfmt run in CI?

Yes. `--check` reports formatting differences through its exit code; `cargo fmt --all -- --check` can fail a CI build when code is not formatted.

What license does rustfmt use?

It is distributed under both the MIT License and Apache License 2.0.

Does rustfmt format comments?

It formats code that contains comments but does not currently attempt to format the comments themselves.

Facts from rustfmt's own pages

Cargo
The `cargo fmt` command formats binary and library targets in a crate and works with Cargo workspaces. · github.com, 3 Oct 2026
Check mode
With `--check`, rustfmt exits with code 0 when no formatting changes are needed and 1 when changes would be made. · github.com, 3 Oct 2026
CI
The README describes using `cargo fmt --all -- --check` to fail a CI build when code is not formatted. · github.com, 3 Oct 2026
CI use
The README describes using `--check` in CI to report formatting differences through an error code. · github.com, 2 Oct 2026
Configuration
Configuration can be set in `rustfmt.toml` or `.rustfmt.toml`, and the default style conforms to the Rust style guide. · github.com, 3 Oct 2026
Direct use
The rustfmt binary formats files in place or reads Rust code from standard input and writes formatted code to standard output. · github.com, 3 Oct 2026
Editor integrations
The README lists integrations or usage instructions for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, and IntelliJ or CLion. · github.com, 3 Oct 2026
Input and output
The rustfmt binary can format files or read Rust code from standard input and write formatted output to standard output. · github.com, 2 Oct 2026
Install
The README installs rustfmt as a component through rustup. · github.com, 3 Oct 2026
IntelliJ and CLion
The IntelliJ and CLion instructions describe enabling rustfmt on save or assigning a shortcut to reformat a file. · github.com, 3 Oct 2026
License
rustfmt is distributed under both the MIT License and Apache License 2.0. · github.com, 3 Oct 2026
Limitations
The README lists limitations involving unparsable code, macros, comments, code fragments, non-ASCII Unicode, and bugs. · github.com, 3 Oct 2026
Limit: comments
Rustfmt does not currently attempt to format comments, though it formats code that contains comments. · github.com, 2 Oct 2026
Limit: macros
The README says some macro declarations and uses are formatted, while macro declarations and uses are listed among rustfmt’s limitations. · github.com, 2 Oct 2026
Nightly options
The README marks coverage, checkstyle, and JSON emit formats as nightly-only options. · github.com, 3 Oct 2026
Purpose
rustfmt formats Rust code according to style guidelines. · github.com, 3 Oct 2026
Security contact
The Rust Security Response Working Group handles vulnerability reports and security issues for rust-lang organization repositories. · github.com, 2 Oct 2026
Style stability
The Rust Edition Guide describes a formatting stability guarantee intended to avoid noisy formatting changes when updating the Rust toolchain. · doc.rust-lang.org, 2 Oct 2026
Support
The README points users to `rustfmt --help` and `cargo fmt --help` for command usage and arguments. · github.com, 3 Oct 2026
Toolchains
The README says rustfmt runs with Rust 1.24 and above, while the latest version requires the nightly toolchain. · github.com, 3 Oct 2026

Where rustfmt stands on Freedom251

Look at these too