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 == '=') {

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

    Issue actions