Skip to main content

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 rustfmt line cap, which defaults to 160. Joined one-liners have tighter caps: 105 columns, or 80 for a two-statement block.

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:

  • fn, if/else, and loop bodies with one statement or expression.
  • match, struct, and enum bodies with up to three arms, fields, or variants.
  • 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 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.

Release files for fastfmt 0.1.4

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.4
File Size Uploaded
fastfmt-0.1.4.tar.gz 17.1 kB Details

Built distributions (wheels)

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

Download URL fastfmt-0.1.4.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
72302efec27aebe9fda57b05942cf6ee2872561d23d815434a721451af27f14d
BLAKE2b-256 checksum
How to use checksums
688520fdc0f7a31245c61ce8fcf98addf05cbd672604d11abfb708e06148617f
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 9, 2026.

Transparency log

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

Download URL fastfmt-0.1.4-py3-none-manylinux_2_28_x86_64.whl
Size 465.5 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f4e78f513c962af15112c47fe5ced11d67e4aa4d6f661e94ce924ffa4953ae4b
BLAKE2b-256 checksum
How to use checksums
bb37ae56e393d0d069c0f6abf8ae55b0ffc2fb8899b67e961f4bef46a4efdc92
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 9, 2026.

Transparency log

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

Download URL fastfmt-0.1.4-py3-none-manylinux_2_28_aarch64.whl
Size 443.7 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b5e04a8f3d0a62898820f1180f1c6b36909b87f1fd74d26fc4eefd599e60a0f3
BLAKE2b-256 checksum
How to use checksums
b708156c56600da959b0be1dadb346035064bd63a8d780b912d4bea7d3416df0
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 9, 2026.

Transparency log

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

Download URL fastfmt-0.1.4-py3-none-macosx_11_0_arm64.whl
Size 430.2 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2b78728e91bbfc3c5947b4938f8c7644fa362f3bc00a66de0a51712765ad3d48
BLAKE2b-256 checksum
How to use checksums
229de16498735304d418bbd7fd098b0542610ee2662be47c079e10962ca715fd
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 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

4 release files

0.1.3

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