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

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 bodies with one statement, if/else and loop bodies with one or two, match/struct/enum bodies with up to three arms, variants, or fields, and single-item impl blocks. 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.0

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.0
File Size Uploaded
fastfmt-0.1.0.tar.gz 14.0 kB Details

Built distributions (wheels)

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

Total release size: 908.6 kB

Release files / fastfmt-0.1.0.tar.gz

Download URL fastfmt-0.1.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a9398fd10b3c7def6147dc44e6bc15927c95d87143272d22ce671ebe8cd1eab7
BLAKE2b-256 checksum
How to use checksums
fb1a94380396057f3afa065818308f9c2afa905758dea5b9215e40461851b416
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.0-py3-none-manylinux_2_28_x86_64.whl

Download URL fastfmt-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Size 475.7 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
03a69f6bf3f2aa4fe893d7ce8f1e9f502bdccb0ac9e0934271665e4f36e2ee16
BLAKE2b-256 checksum
How to use checksums
5d44a42135271a725406b84ce0842f540d70ff9af3310b393f32f4fa894f92b8
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.0-py3-none-macosx_11_0_arm64.whl

Download URL fastfmt-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 418.9 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
62ba8f31dc1447a8486f6f0cbc8a7f9f214cbbbacdbf98c0179a8a997eb9d756
BLAKE2b-256 checksum
How to use checksums
aab0060a2ca17b42f76252d3c54ce7a9391f695710f90b2e102a8bf26df853e3
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

0.1.2

4 release files

0.1.1

4 release files

This release

0.1.0 This release

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