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

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

Built distributions (wheels)

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

Total release size: 1.3 MB

Release files / fastfmt-0.1.1.tar.gz

Download URL fastfmt-0.1.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a5b498d447a47b10ae85b0e35de174489d5807eb084403d5a21c8d60e425c0cc
BLAKE2b-256 checksum
How to use checksums
256ba4402ee372381a4f7dd18d091b68ac1c667a7af7153d87379b6229a1702c
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.1-py3-none-manylinux_2_28_x86_64.whl

Download URL fastfmt-0.1.1-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
f6b836a932f5a26cf7567d5b36719827537f9aff6cb081df548502ee430e6a8b
BLAKE2b-256 checksum
How to use checksums
04e0300da4bbbe3dc955d7d6738e0ad9cda8d6550e3f62872476038520306937
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.1-py3-none-manylinux_2_28_aarch64.whl

Download URL fastfmt-0.1.1-py3-none-manylinux_2_28_aarch64.whl
Size 436.7 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f73b942e4b46d5de2bc5367c57792b0cb83874abd8c79724acf0fe33300ad417
BLAKE2b-256 checksum
How to use checksums
07c78ca24c87367c557d0ccdc675a890339400c859f2ed0e013b7cb33ce6b68b
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.1-py3-none-macosx_11_0_arm64.whl

Download URL fastfmt-0.1.1-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
1e1be677431f26ed012b50c8db250321f91758bfa4b7524ab7adb9052ebd0d15
BLAKE2b-256 checksum
How to use checksums
03a6dcad9a41937f47b6ccfc2b9812efa173e66d23d14e11315e2f3eeeb5557e
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

This release

0.1.1 This release

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