-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add the option to configure rustfmt in the Cargo.toml
metadata tables
#6296
Comments
Thanks for reaching out but I'm going to close. This is something that's come up a few times before and has been discussed and considered, but ultimately rejected and that's still our position today. Some of the more recent discussion is buried so deeply in threads that GitHub links don't work, but hopefully the one below still does because it has a relatively thorough summer of the issues and reasoning behind the decision (let me know if it's inaccessible though and will try to find a way to make that available): |
@calebcartwright Thank you for your comment. I had a look at the thread(s) you linked to, but I wasn't able to find any clear arguments for why this feature was "ultimately rejected". The only reasons I could find were that As you mentioned, I'm probably missing some discussion buried in the GH comment system. Would you mind giving a short summary of why this feature is ultimately not being considered? |
Did you read the entirety of the comment I posted, including the collapsed sections? I ask only so I know what needs clarity or summarization but essentially: Low level tools (rustc, rustfmt, etc.) aren't cargo-aware and that's by design. In the context of cargo-based configuration that doesn't have much impact in cases where low level tools are rarely run directly, but in the case of formatting both the lower level Everything would be fine if configs lived in Cargo.toml and formatting were only ever (or at least primarily) invoked via Additionally, the former would result in a direct violation of rustfmt's stability guarantee with the passage of RFC 3338 |
There's also the issue of precedence and the current feature/availability to have differing rustfmt configurations for individual directories at a more granular level via local
However, if Functionally the only way I could envision that working even in the |
I only skimmed through the thread you linked to get an idea of what the opposing arguments were. I appreciate the points you provided here. From the description of the Either way, I'm sure people have made the same arguments as I have. I also appreciate that stability guarantees put a high burden of care on the addition of these types of features. |
The
Cargo.toml
specification includes[project.metadata]
and[workspace.metadata]
tables, which allows external tools to store arbitrary data. These tables could be used to configurerustfmt
, in addition to the existing.rustfmt.toml
andrustfmt.toml
files.Configuration data for
rustfmt
, in the same format used in the existing.toml
files, could be read from the[package.metadata.rustfmt]
table. The followingrustfmt.toml
file:would be equivalent to the following
Cargo.toml
:The text was updated successfully, but these errors were encountered: