awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
rust-lang avatar

rust-lang/rustfmt

0
View on GitHub↗
6,747 stars·987 forks·Rust·apache-2.0·22 viewsrust-lang.github.io/rustfmt↗

Rustfmt

rustfmt is a Rust code formatter that operates as a Cargo subcommand, applying consistent formatting to Rust source files according to official style guidelines. It parses source code into a syntax tree, applies formatting rules to tree nodes, and pretty-prints the result back to text, with support for TOML-driven configuration that allows per-project style customization.

The formatter is edition-aware, automatically selecting formatting rules based on the Rust edition specified in the project, and supports a style edition override that decouples formatting rules from the Rust edition used for parsing. It includes a nightly style preview mechanism for testing upcoming formatting styles before they are stabilized, and a check-mode compliance enforcement that compares formatted output to original input, returning a non-zero exit code when differences exist.

The tool integrates with CI pipelines to enforce formatting compliance, failing builds automatically when pull request code does not match configured rules. It also supports editor integration for formatting Rust source files directly from within code editors, and can format all binary and library targets in a crate or workspace via a single cargo command.

Features

  • Code Formatting Tools - Applies consistent formatting to Rust source files according to official style guidelines and project configuration.
  • Source Code Formatters - Applies consistent formatting to Rust source files according to official style guidelines and project-specific configuration.
  • Rust Code Formatters - Applies consistent, project-wide formatting to Rust source files according to official style guidelines.
  • Cargo Subcommand Formatters - Integrates with Cargo as a subcommand to format all crate and workspace targets.
  • Cargo Subcommand Formatters - Runs formatting on all binary and library targets of a crate or workspace via cargo fmt.
  • Concrete Syntax Tree Generators - Parses source code into a concrete syntax tree for formatting and pretty-printing.
  • Cargo Subcommand Integrations - Integrates with Cargo to format all crate and workspace targets via a single command.
  • Cargo Workspace Formatters - Runs formatting across all targets in a Rust crate or workspace using a single cargo command.
  • CI Formatting Checks - Checks formatting compliance in automated pipelines and fails builds when code does not match style rules.
  • Source File Evaluation - Reads Rust source files and reformats them in place according to official style guidelines.
  • Editor Formatting Integrations - Integrates with popular editors to format Rust source files directly from the editing environment.
  • Edition-Aware Formatting Rules - Adjusts formatting rules to match the Rust edition specified in the project with optional style edition override.
  • Edition-Aware Formatting Selectors - Automatically selects formatting rules based on the Rust edition specified in the project.
  • Formatting Configurations - Reads formatting options from a TOML configuration file placed in the project or any parent directory.
  • Formatting Compliance Modes - Provides a check mode that exits with non-zero when formatting changes are needed.
  • TOML Configuration Support - Reads formatting options from a TOML configuration file for per-project style customization.
  • Edition-Specific Formatting Rules - Applies the default Rust formatting style that corresponds to the project's Rust edition, varying rules per edition.
  • Code Formatters - Official Rust code formatter.
  • Code Formatting - Official code formatter maintained by the core language team.
  • Rust Projects - Listed in the “Rust Projects” section of the Awesome For Beginners awesome list.
  • Static Analysis Tools - Formats Rust code to style guidelines.

Star history

Star history chart for rust-lang/rustfmtStar history chart for rust-lang/rustfmt

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Open-source alternatives to Rustfmt

Similar open-source projects, ranked by how many features they share with Rustfmt.
  • dprint/dprintdprint avatar

    dprint/dprint

    3,795View on GitHub↗

    dprint is a multi-language code formatter that applies consistent styling across various programming languages using a pluggable architecture. It functions as a unified project style management tool, a command-line interface for continuous integration style enforcement, and a Language Server Protocol implementation for real-time formatting in editors. The project is distinguished by a WebAssembly-based plugin system that loads sandboxed formatting logic from URLs or file paths. It further extends its capabilities through a process-based tool integration that wraps external command-line interf

    Rustformatter
    View on GitHub↗3,795
  • nicklockwood/swiftformatnicklockwood avatar

    nicklockwood/SwiftFormat

    8,835View on GitHub↗

    SwiftFormat is a tool for the Swift language that functions as a code formatter, linter, and refactoring utility. It automatically applies consistent style rules and visual formatting to source files to ensure a uniform appearance across a project. The project differentiates itself by providing both a command-line interface for batch processing and an Xcode extension for integration directly into the development environment. It includes specialized capabilities for modernizing legacy API usage, simplifying language constructs, and inferring formatting options by analyzing an existing codebase

    Swift
    View on GitHub↗8,835
  • google/yapfgoogle avatar

    google/yapf

    13,978View on GitHub↗

    YAPF is a Python code formatter and style compliance tool. It operates as an AST-based reformatter that uses concrete syntax trees to ensure structural consistency and a uniform visual presentation across source files. The engine utilizes a penalty-based layout optimizer to determine the best line breaks by calculating numerical costs for different formatting choices. It employs a multi-process code processor to distribute the formatting of multiple files across several CPU cores. The tool covers source code reformatting through in-place file modifications, difference analysis, and the proce

    Python
    View on GitHub↗13,978
  • google/google-java-formatgoogle avatar

    google/google-java-format

    6,145View on GitHub↗

    google-java-format is a Java code formatter and style enforcement tool. It reformats Java source code to adhere to a standardized style guide, ensuring consistent layout and indentation across entire projects or individual files. The project functions as a build pipeline linting tool for continuous integration workflows and as an IDE formatting plugin to replace native editor formatting. It can be embedded as a formatting library within code generation software to ensure machine-written output remains human-readable. The tool provides capabilities for reorganizing source code indentation and

    Java
    View on GitHub↗6,145
See all 30 alternatives to Rustfmt→

Frequently asked questions

What does rust-lang/rustfmt do?

rustfmt is a Rust code formatter that operates as a Cargo subcommand, applying consistent formatting to Rust source files according to official style guidelines. It parses source code into a syntax tree, applies formatting rules to tree nodes, and pretty-prints the result back to text, with support for TOML-driven configuration that allows per-project style customization.

What are the main features of rust-lang/rustfmt?

The main features of rust-lang/rustfmt are: Code Formatting Tools, Source Code Formatters, Rust Code Formatters, Cargo Subcommand Formatters, Concrete Syntax Tree Generators, Cargo Subcommand Integrations, Cargo Workspace Formatters, CI Formatting Checks.

What are some open-source alternatives to rust-lang/rustfmt?

Open-source alternatives to rust-lang/rustfmt include: dprint/dprint — dprint is a multi-language code formatter that applies consistent styling across various programming languages using a… nicklockwood/swiftformat — SwiftFormat is a tool for the Swift language that functions as a code formatter, linter, and refactoring utility. It… google/yapf — YAPF is a Python code formatter and style compliance tool. It operates as an AST-based reformatter that uses concrete… google/google-java-format — google-java-format is a Java code formatter and style enforcement tool. It reformats Java source code to adhere to a… rust-lang-nursery/rustfmt — rustfmt is a tool that automatically rewrites Rust source code to adhere to a consistent and standardized style guide.… prabirshrestha/vim-lsp — vim-lsp is a Vim plugin that implements the Language Server Protocol to provide an asynchronous code intelligence tool…