-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add lint_groups_priority
lint
#11832
Conversation
6c3e399
to
2811442
Compare
Ugh, I really dislike re-parsing the Is there the possibility to forward this through The problem with the "temporary" part that I see is: I acknowledge that this is an actual problem with the lint table and that we have to do something about this though. @epage Asking for your guidance here: Do you have better ideas on how to address this issue in the short-term? Footnotes
|
rust-lang/cargo#12918 is our issue for this and it links to the future possibility from the RFC for ways that cargo could solve this |
Yeah redefining the lint table isn't ideal, it's defined slightly lax by having It does give nicer diagnostics than the cargo lints that read from |
@epage I saw that linked in the PR description. My question was more about your expectations on when this will be addressed in
The second one would be a long term solution and we could keep this lint permanently in Clippy. But achieving that also seems unrealistic in the short term. |
For 1, that is too large of an effort for me to slip in among the other work I'm trying to finish up. For 2, making the schema available as a package is part of that work I'm trying to finish up so crates.io can use it. It won't have any of the other logic in it like filling in of inferred fields or inheriting from workspaces. |
That's great to hear! In that case, IMO we can merge this now and rework it with the package later. (Maybe together with the other cargo lints we have) @epage Last request: Can I ask you or someone else from the |
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.
Ill have to check check_table
later. As for the serde types, they are more loosely defined which is fine.
Note that this doesn't help with rustdoc.
2811442
to
357af18
Compare
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.
Sorry, lost track of finishing my look at this
I saw Ed point out the Can the lint implementation be updated with this, instead of implementing the parsing logic yourself? https://docs.rs/cargo-util-schemas/latest/cargo_util_schemas/manifest/struct.TomlManifest.html |
I don't think we would be able to get span information from |
The straightforward way of getting spans for a In cargo, we will be experimenting with a less straightforward approach. You can define a serde deserializer that accepts a path to a field and it will error when it gets to that path. You can then get the span from the error. |
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.
Alright, I don't want to block this any longer. Sorry for the long time it took me to get back to this. I just have one clarifying question, then this is ready to go.
// internally warnings is considered a lint rather than a group | ||
rustc_groups.insert("warnings"); |
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.
Does this matter? I think that you can pass in -Dwarnings
anywhere and it won't change the lint level of any other lint you set before/after, as warnings
is not actually a group but some special handled keyword/lint.
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.
Yeah looks like it doesn't matter, removed it 👍
357af18
to
6ffd545
Compare
Warns when a lint group in Cargo.toml's `[lints]` section shares the same priority as a lint
6ffd545
to
6619e8c
Compare
@bors r+ Thanks! Also a big thanks to Ed for helping with the review! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Warns when a lint group in Cargo.toml's
[lints]
section shares the same priority as a lint. This is in the cargo section but is categorised ascorrectness
so it's on by default, it doesn't callcargo metadata
though and parses theCargo.toml
directlyThe lint should be temporary until rust-lang/cargo#12918 is resolved, but in the meanwhile this is an common issue to run into
cargo clippy
not obeying[lints.clippy]
fromCargo.toml
, but only for some lints #11237doc-valid-idents
not respected in Cargo.toml [lints] table #11751clippy::pedantic
inCargo.toml
#11830changelog: Add [
lint_groups_priority
] lintr? @flip1995