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 160). 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.3

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.3
File Size Uploaded
fastfmt-0.1.3.tar.gz 16.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fastfmt 0.1.3
File Interpreter ABI Platform
fastfmt-0.1.3-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
fastfmt-0.1.3-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
fastfmt-0.1.3-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.3.tar.gz

Download URL fastfmt-0.1.3.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3adceb987fc44b9b0199d3abdcaa2fbc5d3f62ec2bd267090138a6bfd431464e
BLAKE2b-256 checksum
How to use checksums
f85a40f897240a4e7dcf757c093fac6d21371f594653eac7eae0f104d47c3df3
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 29, 2026.

Transparency log

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

Download URL fastfmt-0.1.3-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
4af5e9ab03dca8ed80ec06c8c796d8cd1aa10cad52b38b38425f84f6ca66b1e9
BLAKE2b-256 checksum
How to use checksums
67eaafcef3bf8168967ae5fe98d4d1ddace3edfee197c5893e72e9b8bef73665
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 29, 2026.

Transparency log

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

Download URL fastfmt-0.1.3-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
5cd91d88610564988ddde7621700f59309286f30a9e47e736ebc735a996520bc
BLAKE2b-256 checksum
How to use checksums
bb874a09fc5987a8e478533cd9e075d4ac6b25a9a8de8ad61be80432155c12cd
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 29, 2026.

Transparency log

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

Download URL fastfmt-0.1.3-py3-none-macosx_11_0_arm64.whl
Size 427.8 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
793e9fa458b859d991688f936e549b66f184124a593444cf90509ab6c891a231
BLAKE2b-256 checksum
How to use checksums
275eaec14b18b611313dbdcabe86c393a010fe91bd829a391e087f63374005ac
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

4 release files

This release

0.1.3 This release

4 release files

0.1.2

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