Skip to content
SPECIFICTION
Get listed

clang-format vs rustfmt

clang-format

clang.llvm.org

rustfmt

rust-lang.github.io

Side by side

Figureclang-formatrustfmt
Price from—Free
Free plan—Yes
Free trial——
Open source——
WindowsYesYes
macOSYesYes
LinuxYesYes
Plans published01
Spec score · Code formatters7.7 (#8)7.9 (#4)
Spec score · Code Formatting Tools7.6 (#20)8.0 (#10)
ConfigurationFormatting styles can be set with command-line options or project-level .clang-format or _clang-format files.Configuration can be set in `rustfmt.toml` or `.rustfmt.toml`, and the default style conforms to the Rust style guide.
Editor integrationsThe documentation describes integrations for Vim, Emacs, BBEdit, CLion, Visual Studio, and Visual Studio Code.The README lists integrations or usage instructions for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, and IntelliJ or CLion.
LicenseLLVM releases are distributed under the Apache-2.0 license with LLVM exceptions, which the download page describes as OSI-approved.rustfmt is distributed under both the MIT License and Apache License 2.0.
PurposeClangFormat is a set of tools built on LibFormat for formatting source code, available as a standalone tool and through editor integrations.rustfmt formats Rust code according to style guidelines.
SupportThe Clang guide directs users who encounter problems to file bugs on the LLVM bug tracker.The README points users to `rustfmt --help` and `cargo fmt --help` for command usage and arguments.

Plans

clang-format

No plans published.

clang-format pricing →

rustfmt

  • rustfmtFree

rustfmt pricing →

In their own words

clang-format

clang-format has no write-up on Specifiction yet; its figures are above.

Visit clang.llvm.org

rustfmt

rustfmt formats Rust code according to style guidelines. It can format files directly or read code from standard input and write formatted output to standard output. With Cargo, `cargo fmt` formats binary and library targets in a crate and works with workspaces. A `rustfmt.toml` or `.rustfmt.toml` file can hold configuration, including stable and nightly-only options. For automated checks, `--check` returns code 0 when no formatting changes are needed and code 1 when changes would be made; it can be used in CI to fail a build on formatting differences. The README lists editor use with Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, IntelliJ, and CLion. Rustfmt is available on Windows, macOS, and Linux, and is distributed under the MIT License and Apache License 2.0. It does not attempt to format comments, and listed limitations also involve macros, unparsable code, fragments, and non-ASCII Unicode. Unstable settings require opt-in on nightly, and the README says the latest version requires the nightly toolchain.

Visit rust-lang.github.io