Skip to content

Conversation

blyxyas
Copy link
Member

@blyxyas blyxyas commented Sep 7, 2025

This PR creates an RFC for how clippy.toml should be handled. I made some improvements to some parts of the system. These are better to get fixed today than to wait until someone has a problem with them and then have to make a breaking change.

Based on Philipp's RFC. This would be the first stage of 3 to completely stabilize clippy.toml

Being that Philipp is on vacation, I'm not sure who could review this, it's a team-wide thing anyways.

changelog:none

Rendered

@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2025

flip1995 is not on the review rotation at the moment.
They may take a while to respond.

@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2025

r? @flip1995

rustbot has assigned @flip1995.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 7, 2025
@blyxyas blyxyas force-pushed the rfc-stable-clippytoml branch from d64c47e to e5a9868 Compare September 7, 2025 16:47
This PR creates a public RFC for how clippy.toml should be handled. I made some improvements
to some parts of the system. These are better to get fixed today than to wait until someone has a problem with them
and then have to make a breaking change.

Based on Philipp's RFC. This would be the first stage of 3 to completely stabilize clippy.toml
@blyxyas
Copy link
Member Author

blyxyas commented Sep 7, 2025

@ojeda Is this more or less what you need?

The RFC stabilizes the existence of the Clippy configuration file, the algorithm to find it, the existence of CLIPPY_CONF_DIR and its behaviour, the existence of a new CLIPPY_CONF_PATH (which will be the preferred way to pass configuration into Clippy, but CLIPPY_CONF_DIR will not be removed anytime soon), and the format of the configuration itself as a subset of TOML.

The only thing needed apart from this would be stabilizing the configuration options themselves. Which, because of your usecase, the first ones will be msrv, check-private-items, disallowed-macros and doc-valid-idents.

@ojeda
Copy link
Contributor

ojeda commented Sep 7, 2025

Thanks for working on this!

The only thing needed apart from this would be stabilizing the configuration options themselves. Which, because of your usecase, the first ones will be msrv, check-private-items, disallowed-macros and doc-valid-idents.

That would be great.

It may be good to mention in the RFC what would be the "stable mode" -- IIUC it would fail on unknown keys (like Clippy today), but it would not allow to use unstable keys (unlike Clippy today). Is that correct?

If so, then does that mean that unless all those options (msrv etc.) are stabilized before the default behavior changes, we would need to have 2 files to be able to make it work with old and new Clippy?

There isn't a good way to specify configuration values from the terminal, for the time being.

If Clippy plans to support that eventually, then an alternative would be to not stabilize the file and go for flags directly -- for us it would make it easier to pass flags to Clippy depending e.g. on the version.

But, of course, that would open again the questions about how to pass all what the TOML allows for non-trivial keys. IIRC we discussed it in Zulip a while ago.


The list of available configurations along their default values is
[here](https://doc.rust-lang.org/nightly/clippy/lint_configuration.html).
You can enable unstable features via the `unsable-conf` configuration option. If this configuration is set to `true`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can enable unstable features via the `unsable-conf` configuration option. If this configuration is set to `true`,
You can enable unstable features via the `unstable-conf` configuration option. If this configuration is set to `true`,

[here](https://doc.rust-lang.org/nightly/clippy/lint_configuration.html).
You can enable unstable features via the `unsable-conf` configuration option. If this configuration is set to `true`,
Clippy will warn about unknown or renamed keys, and will allow the modification of unstable configuration options. One
can use `unstable-conf = true` sparingly in their development cycle to check for unknown Rust to check for typos or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
can use `unstable-conf = true` sparingly in their development cycle to check for unknown Rust to check for typos or
can use `unstable-conf = true` sparingly in their development cycle to check for typos or

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants