Generating config file includes all unstable features and generates bunch of warnings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
I have tried to search issues and reading README / website but I did not find any help for this issue. I'm not sure if this is a bug or intended to work this way.
In short:
- Generated rustfmt.toml
- Tried to format project
- Got a lot warnings
Longer explanation
Readme has this tip:
When you run rustfmt, place a file named rustfmt.toml or .rustfmt.toml in target file directory or its parents to override the default settings of rustfmt. You can generate a file containing the default configuration with
rustfmt --print-config default rustfmt.tomland customize as needed.
When I run that command or cargo fmt -- --print-config default .rustfmt.toml, and after that run cargo fmt I get a lot warnings that this and that configuration option is not available.
For example this
Warning: can't set
where_single_line = false, unstable features are only available in nightly channel.
Is is intended that print-config command generates config file that does not work with stable toolchain or with unstable features disabled? I would have expected that if I run that command with stable toolchain, it would generate config file that then works and includes only stable features.
Another minor thing that feels weird, is that the edition setting was set to 2015 even though Cargo.toml is set to 2021. :)
Versions:
> cargo fmt --version
rustfmt 1.5.1-stable (897e3755 2022-11-02)
> cargo --version
cargo 1.65.0 (4bc8f24d3 2022-10-20)
MacOS 12.6
I can provide more information if needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing rustfmt --print-config default rustfmt.toml and cargo fmt -- --print-config default .rustfmt.toml with the reported stable versions. Inspect the print-config implementation and its tests, then verify whether generated configuration should exclude unavailable unstable options and reflect the project's edition without warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100