Skip to content

No way to pass multiple values to list-like --config options #6097

Open
@jaybosamiya

Description

@jaybosamiya

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:

rustfmt/src/bin/main.rs

Lines 572 to 577 in 21f353a

options.inline_config = matches
.opt_strs("config")
.iter()
.flat_map(|config| config.split(','))
.map(
|key_val| match key_val.char_indices().find(|(_, ch)| *ch == '=') {

Activity

added a commit that references this issue on Feb 28, 2024
ytmimi

ytmimi commented on Mar 5, 2024

@ytmimi
Contributor

Thanks for the report. Going to link to the tracking issue for skip_macro_invocations #5346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    only-with-optionrequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jaybosamiya@ytmimi

        Issue actions

          No way to pass multiple values to list-like `--config` options · Issue #6097 · rust-lang/rustfmt