fastfmt
cargo fmt, then put the one-liners back.
Stable rustfmt expands constructs such as short function bodies, statement-position if/else, and short match or struct bodies. Some options for keeping them compact are nightly-only. Others have no rustfmt option. fastfmt runs rustfmt through stdin, then rejoins comment-free constructs within its size and width limits, giving fastai-style compact Rust from a stable toolchain.
Install and use
pip install fastfmt
The wheel contains one cargo-fastfmt binary and no Python code. With the binary on PATH, Cargo recognizes it as a subcommand:
cargo fastfmt # format the current directory tree in place
cargo fastfmt --check # exit 1 listing files that would change; write nothing
cargo fastfmt src lib.rs # format specific files or directories
rustfmt must also be on PATH. Install it with rustup component add rustfmt.
--width N sets the line cap for rustfmt and joined one-liners, which defaults to 160.
On a normal run, fastfmt creates or updates the target project's rustfmt.toml with disable_all_formatting = true. This prevents cargo fmt or editor rustfmt runs from undoing the compact formatting. fastfmt overrides the setting for its own pass. No pre-existing config file is needed.
--check never writes the config. It reports a missing or disabled guard as a required update.
Joining rules
A construct can join onto one line when it fits the width cap and contains no comments or multiline tokens. The supported constructs are:
- Ordinary blocks, including function, closure,
if/else, and loop bodies, with at most one statement, optionally followed by a tail expression. match,struct, andenumbodies with up to three arms, fields, or variants.- Single-item
implblocks.
Semicolons are preserved exactly. A statement-position else starts on a new line. An if/else used as a value stays on one line.
Joins run innermost-first and repeat until nothing more can join. This allows nested constructs to collapse fully. Blocks used as match-arm bodies stay expanded. Blocks containing comments or multiline strings retain rustfmt's output.
Metadata
Release files for fastfmt 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastfmt-0.1.5.tar.gz | 17.5 kB | With provenance | Details for fastfmt-0.1.5.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastfmt-0.1.5-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for fastfmt-0.1.5-py3-none-manylinux_2_28_x86_64.whl |
| fastfmt-0.1.5-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for fastfmt-0.1.5-py3-none-manylinux_2_28_aarch64.whl |
| fastfmt-0.1.5-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for fastfmt-0.1.5-py3-none-macosx_11_0_arm64.whl |
Total release size: 1.4 MB
Release files / fastfmt-0.1.5.tar.gz
| Download URL | fastfmt-0.1.5.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9d3e692ac8425d2c28a8b0730f5ffb09a464c5c2453b0e30e4071905359143d
|
|
BLAKE2b-256 checksum How to use checksums |
6cce6373ecfe7cc06ada6847c6f87e7896cc7785454b838be8bb267d7c15fa1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / fastfmt-0.1.5-py3-none-manylinux_2_28_x86_64.whl
| Download URL | fastfmt-0.1.5-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 466.4 kB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
2d267c66802b09fd2c8e675a435b8d5ac3aa0fe17aaa67eb38fb121972ee0703
|
|
BLAKE2b-256 checksum How to use checksums |
262f2d1f84f781ec9da4a7389831799ccfc48dc256281d1c24f3470164bdc3bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / fastfmt-0.1.5-py3-none-manylinux_2_28_aarch64.whl
| Download URL | fastfmt-0.1.5-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 444.2 kB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
3ef128127c69482e49c00e1b8636cfe80ebda208d146b47bd2b0b287ac97536d
|
|
BLAKE2b-256 checksum How to use checksums |
93d3ee3c1c70f930962c97c0106c22b32b8f3f1ca5c09a5f9c67fea346da8e3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / fastfmt-0.1.5-py3-none-macosx_11_0_arm64.whl
| Download URL | fastfmt-0.1.5-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 430.7 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c1db7c2428e540fe1704526ffbd19b29220838b20792c4afe7d52936096533cd
|
|
BLAKE2b-256 checksum How to use checksums |
404c59535b856dc72a9b7795950fe5f315738d34cd83059c6a996781e02d144d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logSecurity for fastfmt 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for fastfmt-0.1.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.