# rust-lang-nursery/rustfmt

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rust-lang-nursery-rustfmt).**

6,877 stars · 1,020 forks · Rust · Apache-2.0

## Links

- GitHub: https://github.com/rust-lang-nursery/rustfmt
- Homepage: https://rust-lang.github.io/rustfmt/
- awesome-repositories: https://awesome-repositories.com/repository/rust-lang-nursery-rustfmt.md

## Description

rustfmt is a tool that automatically rewrites Rust source code to adhere to a consistent and standardized style guide. It functions as both a code formatter for transforming source files and a style linter used to verify if code matches required formatting rules.

The system is configurable, allowing for the definition of custom formatting rules and language editions through configuration files to override default styles. It also supports selective formatting by using dedicated skip markers to prevent specific blocks of code from being modified.

The tool provides capabilities for both source code rewriting across project directories and style compliance verification to identify non-compliant source during automated builds.

## Tags

### Development Tools & Productivity

- [Source Code Rewriting](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-to-source-conversion/source-code-rewriting.md) — Automatically rewrites Rust source code to adhere to a consistent style guide across project directories. ([source](https://github.com/rust-lang-nursery/rustfmt#readme))
- [Automatic Code Formatters](https://awesome-repositories.com/f/development-tools-productivity/automatic-code-formatters.md) — Automatically rewrites Rust source code to adhere to a consistent and standardized style guide.
- [Coding Style Tools](https://awesome-repositories.com/f/development-tools-productivity/developer-utilities-libraries/developer-tools/code-quality-verification/coding-style-tools.md) — Includes a verification utility to check if source code matches the required style guide for automated builds. ([source](https://github.com/rust-lang-nursery/rustfmt#readme))
- [Formatting Configurations](https://awesome-repositories.com/f/development-tools-productivity/formatting-configurations.md) — Allows customization of formatting behavior and language editions via a configuration file. ([source](https://github.com/rust-lang-nursery/rustfmt#readme))
- [Formatting Engines](https://awesome-repositories.com/f/development-tools-productivity/formatting-engines.md) — Provides a rule-based engine that determines the final layout of tokens and whitespace based on configuration.
- [Formatting Exclusion Directives](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/static-analysis-engines/static-analysis-tools/code-formatting-tools/formatting-exclusion-directives.md) — Provides mechanisms to selectively disable code formatting for specific blocks using skip markers. ([source](https://github.com/rust-lang-nursery/rustfmt#readme))

### Programming Languages & Runtimes

- [Source Code Formatters](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-formatters.md) — Preventing specific blocks of Rust code from being modified by the formatter using dedicated skip markers.
- [Style Compliance Tools](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/systems-languages/rust/style-compliance-tools.md) — Verifies that Rust code matches required style guidelines to prevent errors during CI processes.
- [Style Linters](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/systems-languages/rust/style-linters.md) — Verifies if Rust code matches required formatting rules and returns errors for non-compliant source.
- [Formatting Exclusion Markers](https://awesome-repositories.com/f/programming-languages-runtimes/formatting-exclusion-markers.md) — Identifies specific attributes or comments in the source to skip the transformation process for those code segments.
- [Token Stream Preservation](https://awesome-repositories.com/f/programming-languages-runtimes/token-stream-preservation.md) — Maintains a mapping of original tokens to ensure comments and attributes remain attached to their related expressions.

### Software Engineering & Architecture

- [Formatter Configurations](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/configuration-scopes/application-configuration/formatter-configurations.md) — Utilizes external configuration files to define formatting rules and file exclusion patterns.
- [Idempotency Patterns](https://awesome-repositories.com/f/software-engineering-architecture/idempotency-patterns.md) — Employs an idempotent formatting cycle to ensure stable and consistent style application through repeated processing.
- [Language-Specific Formatting Overrides](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/domain-specific/language-support-definitions/language-parsing-rules/language-specific-formatting-overrides.md) — Supports defining specific formatting overrides and language editions for Rust projects.
- [Recursive Tree Transformers](https://awesome-repositories.com/f/software-engineering-architecture/recursive-tree-transformers.md) — Uses a recursive tree transformer to walk the syntax tree and apply indentation and line-breaking rules.

### Part of an Awesome List

- [Developer Tools](https://awesome-repositories.com/f/awesome-lists/devtools/developer-tools.md) — Tool for enforcing consistent code formatting.
