rust-lang / rust-lang/rustfmt

Parallelise formatting files and projects

Open
#3,162 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

fun! P-low
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

I see two ways to parallelise rustfmt pretty easily: in cargo-fmt, run the rustfmt processes in parallel, rather than sequentially (up to a max of the number of cores). This should be pretty trivial to do. And inside rustfmt, format multiple files at a time (spawning one thread per queue). This is a bit more difficult since we'll need to use a thread pool and we'll need to make the Rustfmt state thread-safe. There second will probably work better and if we do that, then we probably shouldn't also do multi-process cargo-fmt.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the cargo-fmt process flow with rustfmt's internal formatting flow, focusing on where files or projects are currently handled sequentially. Determine which parallelisation approach is viable and what state must be made thread-safe. Done means formatting work can run concurrently with bounded resource use without changing formatting results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.