Skip to main content

fastfmt

cargo fmt, then put the one-liners back.

Stable rustfmt always breaks small constructs onto multiple lines: a single-expression fn body, a statement-position if/else, a short match or struct body. The options that would prevent this are nightly-only, and some shapes have no option at all. fastfmt runs rustfmt (via stdin, so no config file is needed), then re-joins those constructs when they are comment-free, small, and within a width cap, giving fastai-style compact Rust from a stable toolchain.

Install

pip install fastfmt

The wheel ships a single cargo-fastfmt binary and no Python code. With it on PATH, cargo picks it up 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

--width N sets the rustfmt line cap (default 130). Joined one-liners use tighter caps: 105 columns, or 80 for a two-statement block. rustfmt must be on PATH (rustup component add rustfmt).

On each normal run, fastfmt creates or updates the target project's rustfmt.toml with disable_all_formatting = true. This makes accidental cargo fmt and editor rustfmt runs harmless; fastfmt overrides the setting for its own rustfmt pass. In --check mode the config is never written, and a missing or disabled guard is reported as a required update.

What gets joined

A block joins onto one line only when nothing in it is a comment or spans multiple lines itself, and the result fits the cap: fn, if/else, and loop bodies with one statement or expression, match/struct/enum bodies with up to three arms, variants, or fields, and single-item impl blocks. 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 to a fixpoint, so nested one-liners collapse fully. Match arms stay expanded, and any block containing a comment or a multi-line string is left exactly as rustfmt wrote it.

Release files for fastfmt 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastfmt 0.1.2
File Size Uploaded
fastfmt-0.1.2.tar.gz 15.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fastfmt 0.1.2
File Interpreter ABI Platform
fastfmt-0.1.2-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
fastfmt-0.1.2-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
fastfmt-0.1.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 1.4 MB

Release files / fastfmt-0.1.2.tar.gz

Download URL fastfmt-0.1.2.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
446519888354830ea7eeb7930c1eea1c9ee2cbccedd654acd0f160152b039a35
BLAKE2b-256 checksum
How to use checksums
8d4680ec713f2567942eba3ab358d808f175476b0baf7a627235f4f8aac7da8d
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 Aug 28, 2026.

Transparency log

Release files / fastfmt-0.1.2-py3-none-manylinux_2_28_x86_64.whl

Download URL fastfmt-0.1.2-py3-none-manylinux_2_28_x86_64.whl
Size 484.2 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c3af45c1d2e7f80a63a146c37cef222432edf4eb38ededce16e31989eb9a9a22
BLAKE2b-256 checksum
How to use checksums
9be530a23aa6c16493fd26eaa226374b496f91e39521e6439b463487303d1d9b
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 Aug 28, 2026.

Transparency log

Release files / fastfmt-0.1.2-py3-none-manylinux_2_28_aarch64.whl

Download URL fastfmt-0.1.2-py3-none-manylinux_2_28_aarch64.whl
Size 446.1 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
8dab35fa3d3a609f17e3f73e1e883aa40b4852e0db51baa635e0d0810d074a82
BLAKE2b-256 checksum
How to use checksums
21dfdf259dc5e04a2e5d13d922c41fe75b6a85add690937e1da64b07a11aa2cf
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 Aug 28, 2026.

Transparency log

Release files / fastfmt-0.1.2-py3-none-macosx_11_0_arm64.whl

Download URL fastfmt-0.1.2-py3-none-macosx_11_0_arm64.whl
Size 427.9 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
292bed6ccf1ca792b7fb3b40e052caadd776fe77d77ec9caa622cbb5a25a484d
BLAKE2b-256 checksum
How to use checksums
05d5c9261632dd67b29d25ed84db5ad2231642bc8948833f3020eed181b86d76
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 Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

4 release files

0.1.3

4 release files

This release

0.1.2 This release

4 release files

0.1.1

4 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page