Skip to content
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

track configs set from cli flags #6253

Merged

Conversation

calebcartwright
Copy link
Member

resolves #6252

There's more detail in that linked issue, but rustfmt internally needs to know whether the user explicitly specified a configuration value via a top level cli flag, e.g. --edition or --style-edition. This PR adds a separate boolean flag on configuration options that indicates whether the user specified it via a top level cli flag.

Notably, this intentionally does not make any changes to the config.set().* calls, nor the config.was_set().* behavior. That's because I'm unclear on the historical reasons why those ignored the CLI flag method, at this time I'm unclear on the potential side effects of changing that behavior, and we don't need to resolve nor risk any of that for the purposes of the 2024 work (i left an inline FIXME to revisit)

@calebcartwright
Copy link
Member Author

As a thought for future cleanup on this, I think perhaps we can expand the programmatic config setting logic to take an argument indicating whether it's a user supplied value or a rustfmt internal override like one of these:

config.set().wrap_comments(false);

And then the config setter logic can use that to determine whether or not to flip the flag

@calebcartwright calebcartwright merged commit a23d3cc into rust-lang:master Jul 27, 2024
26 checks passed
@calebcartwright calebcartwright deleted the cli-config-tracking branch July 27, 2024 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config tracking of non-default CLI flags
2 participants