rust-lang / rust-lang/rustfmt

structured configuration

Open
#3,487 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prior to rustfmt 1.0 we trimmed most of the configuration options for maintainability. I am ok to add some of them back, as long as they are orthogonal to other part of code (like imports_indent). where is not one of them, so it is unlikely that we add it back. Sorry.

If we were to add more options, I prefer those to be more structured rather than having plain namespace. E.g., something like the following:

# You can explicitly add [default] or omit it.
indent = "Block"

[fn]
indent = "Visual"

[struct.pattern]
width = 100

[struct.expr]
width = 0

and you will get:

fn foo(xxxxxxxxxxxxxxxxxxxxxxxxxx: u32,
       yyyyyyyyyyyyyyyyyyyyyyy: u32,
       zzzzzzzzzzzzzzzzz: u32)
{
    let Graphviz { label, caption, scale, width, height } = self.graphviz;
    /// ...
    let result = Ok(GraphvizGen {
        file,
        path,
        graphviz,
    });
    // ...
}

Originally posted by @topecongiro in https://github.com/rust-lang/rustfmt/issues/3316#issuecomment-477614459

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 reviewing the issue discussion and the structured TOML examples. The proposal concerns redesigning rustfmt configuration into nested sections such as [fn], [struct.pattern], and [struct.expr], but the issue names no implementation files or tests. Done would require an agreed configuration design and corresponding formatter behavior.

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
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.