-
-
Notifications
You must be signed in to change notification settings - Fork 354
Workspace Clippy lint management #1550
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
Conversation
Make all lints managed centrally in one place. Note that this approach forces pedantic lints on the entire codebase - which means that when the new versions of rust are released, some new lint may fail the build. At the same time, this allows new lints to always be noticed and manually excluded. The big list of allowed lints can be slowly worked through and forbidden one by one.
…kspace lints It was only needed to unify what Clippy does, but now there is better ways to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great, thank you!
I also removed a configuration file that I thought was only for clippy.
- Why is there a separate MSRV in clippy.toml that does not match the one in Cargo.toml?
Clippy should be close to the latest stable release if it's affordable, i.e. if it doesn't want to change everything. Now that can be controlled much better, so maybe one can increase the clippy level.
rust-version
is a difficult field as one can't really increase it without disturbing someone downstream. So as long as it compiles on this level, it should stay on this level. Interestingly, I am not quite sure if this is truly tested, and if rustc
really sets itself to this level internally - I doubt it. So chances are it doesn't really compile with this level anyway, but I also don't really know.
- Unrelated, but really puzzling - why do you have a copy of
gix-packetline
asgix-packetline-blocking
?
gix-filter
uses it and needs it in blocking
mode. But if it would be using the original gix-packetline
it would have to configure it, and thus prevent anybody downstream who uses gix-filter
from using an async version of gix-packetline
, which is also used for fetching and pushing.
To resolve this, there is a managed copy of gix-packetline
, a crate which fortunately is very stable already.
And while trying to use Clippy v1.80, I realized that the actual reason for leaving it at the MSRV of 1.74 is to prevent it from suggesting methods that aren't available on the MSRV compiler yet. Maybe it's an option to use the latest clippy (or to not configure the language level at all) and instead allow all new lints that it would find. |
Actually, I think I will leave it as is and just increase the clippy version once the MSRV is increased - it seems like the easiest and least surprising choice. |
@Byron Sorry, not sure I understand.
Can you solve this by simply aliasing it in Cargo.toml? E.g. |
You are right. Effectively though, I think there is no breaking 'suggestion' between 1.65 and 1.74 (but there are breaking suggestions in 1.80). What I really would like to do is have a tool that determines the lowest possible Rustc compiler, and sets the value accordingly. The current value is just something low that worked, but definitely not the lowest possible.
Cargo will still do dependency resolution based on the actual name, so the 'new name' only affects the name that can be used in code. If that would be possible, it would definitely allow to get rid of the copy. |
I think you could use cargo-hack to determine minimum msrv? Just needs to specify a lower bound (and a possible upper bound) to avoid having too many iterations |
I think I would run it if I had a 'for the lazy' script that runs it over all crates in a workspace. If it auto-edits the manifests, it should be good to go after |
For msrv, you can use cargo msrv tool. But I still don't understand why you would want to specify version twice - once in Cargo.toml and once in clippy.toml |
Thanks! |
@Byron but the latest available lints are determined by the version of |
I don't think that's entirely true - I am running the latest version of clippy and only if I increase the version of the |
that's so weird - are you certain? When I was implementing some of the Clippy lints, I used the The internal |
I am certain that the Probably you are completely right - the If this is true, then there is no benefit of setting the If you conquer, I'd welcome a PR that removes |
Thx, that was my point exactly - I removed it in #1558 |
Make all lints managed centrally in one place.
Note that this approach forces pedantic lints on the entire codebase - which means that when the new versions of rust are released, some new lint may fail the build. At the same time, this allows new lints to always be noticed and manually excluded.
The big list of allowed lints can be slowly worked through and forbidden one by one.
Other changes
This PR also fixes one missing semicolon, formats a few Cargo.toml files, and adjusts the justfile clippy recipe to cover more cases.
Note that this PR effectively closes #874 because now the list of lints is tracked in code.
TODO
gix-packetline
asgix-packetline-blocking
?