rustfmt vs Scalafmt
rustfmt
rust-lang.github.ioScalafmt
scalameta.orgSide by side
| Figure | rustfmt | Scalafmt |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| Self-hosted | — | Yes |
| Plans published | 1 | 1 |
| Spec score · Code Formatting Tools | 8.0 (#10) | 7.6 (#22) |
| Configuration | Configuration can be set in `rustfmt.toml` or `.rustfmt.toml`, and the default style conforms to the Rust style guide. | Formatting options are set in a plain text .scalafmt.conf file using HOCON syntax. |
| Editor integrations | The README lists integrations or usage instructions for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, and IntelliJ or CLion. | The documentation describes use with IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text, and Eclipse, with Metals supporting formatting requests from editors. |
| License | rustfmt is distributed under both the MIT License and Apache License 2.0. | The GitHub repository identifies the project license as Apache-2.0. |
| Purpose | rustfmt formats Rust code according to style guidelines. | Scalafmt is a code formatter for Scala that formats code consistently across a team. |
| Support | The README points users to `rustfmt --help` and `cargo fmt --help` for command usage and arguments. | The project site links to a community Discord and GitHub, and the CLI help directs bug reports to GitHub issues. |
Plans
In their own words
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.
Scalafmt
Scalafmt is a free Scala code formatter for keeping formatting consistent across a team. It handles Scala 2, Scala 3, sbt files and Scala scripts, with one dialect selected for each file. Formatting options are stored in a plain-text .scalafmt.conf file using HOCON syntax. Since version 3.1.0, the configuration must explicitly specify both the version and runner.dialect. Scalafmt can run from an editor, build tool or terminal. Documented editor integrations include IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text and Eclipse; Metals supports formatting requests from editors. It integrates with sbt and documents integrations for Maven, Gradle and Mill. Command-line check and test modes report misformatted code without writing changes. It also supports ignoring files, changed-lines formatting and a library API. IntelliJ range formatting uses IntelliJ’s own formatter by default: Scalafmt is designed primarily for whole files, and selected ranges may produce undesirable results. The project license is Apache-2.0.