rust-lang / rust-lang/rustfmt

Extend config option similar to package.json prettier field

Open
#5,313 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Request

Could we get a field to specify a rustfmt.toml configuration either within cargo.toml or rustfmt.toml

example:

#cargo.toml

rustfmt-extends = { git = "https://github.com/some-global-rustfmt-config", branch = "main" }

Rational

I'm working on multiple backend micro-services in rust. In every single repo I'd like to have the exact same styling / formatting. Currently I'm copying over the rustfmt.toml file to each repo and if there's a configuration change I or someone else on my team makes we end up copying over the new file to all the repos. Ideally it would be nice if we could just point to a github repo and a rustfmt.toml and have cargo pull it down and rustfmt use it.

This is similar to what formatters like prettier allow for frontend repos. (ex. npm i some-prettier-config)

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

The request names Cargo.toml and rustfmt.toml but no source files or tests. Start by reviewing existing rustfmt configuration discovery and Cargo manifest handling; done means a shared remote configuration can be declared and used consistently, with behavior and failure cases covered.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.