Skip to content

Can't enable unstable features #4353

Closed
Closed
@austinglaser

Description

@austinglaser

Describe the bug

rustfmt does not appear to accept the unstable_features = true option (documented here) in rustfmt.toml

To Reproduce

  • Create an empty cargo project
  • Write the following rustfmt.toml:
    unstable_features = true
    merge_imports = true
  • Invoke rustfmt
$ cargo fmt
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
$ rustfmt src/main.rs
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.

Interestingly, I cannot override this on the command line:

$ rustfmt src/main.rs --config unstable_features=true
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.

If I change rustfmt.toml to simply be

merge_imports = true

I get

$ rustfmt src/main.rs --config unstable_features=true
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.

However, with an empty rustfmt.toml, the following works:

$ rustfmt src/main.rs --config unstable_features=true --config merge_imports=true

So it looks like perhaps this is associated solely with loading the config?

Expected behavior

When unstable_features = true is set in rustfmt.toml, rustfmt should accept and act on unstable options like merge_imports without producing warnings.

Furthermore, a command-line specification of --config unstable_features=true should enable unstable features when loaded from rustfmt.toml

Meta

  • rustfmt version: rustfmt 1.4.15-stable (530eadf4 2020-06-02)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: primarily cargo fmt and editor on-save hooks, but see above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions