rust-lang / rust-lang/rustfmt

No way to pass multiple values to list-like `--config` options

Open
#6,097 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

only-with-option
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

There appears to be no way to pass multiple values to a configuration parameter such as skip_macro_invocations from the command-line:

$ rustfmt --config 'skip_macro_invocations=["foo","bar"]'
invalid key=val pair: `skip_macro_invocations=["foo"`

$ rustfmt '--config=skip_macro_invocations=["foo","bar"]'
invalid key=val pair: `skip_macro_invocations=["foo"`

I believe this is due to the immediate split of the argument done here: https://github.com/rust-lang/rustfmt/blob/21f353a6373126035f9063780bdccb9dd191a2bb/src/bin/main.rs#L572-L577

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 in src/bin/main.rs around lines 572–577 and reproduce the issue with the shown rustfmt --config commands. Trace how the command-line argument is split, then verify that list-like options such as skip_macro_invocations can receive multiple values without being truncated at the comma. The issue is done when both shown forms are accepted correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.