-
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
uninlined_format_args
cannot be "allowed" in Cargo.toml
#12161
Comments
This happens because of how lint tables are implemented in Cargo. See #12093 for what's happening here. The TL;DR is that if you don't specify a priority for a lint entry in the table, then a default priority of 0 is used. Cargo sorts lint entries with the same priority in an arbitrary order, and at the moment it happens to sort them in reverse alphabetical order. You can fix it by giving pedantic a negative priority pedantic = { priority = -1, level = "deny" } That way the default priority 0 will override it. |
Oh. that's interesting and strange. Now I tried and if I put the flags on the command line in a different order where pedantic is at the end then both of the other two lints will complain as pedantic overrides the "allow" I just added.
Thanks for the quick reply. I guess I can close this issue then. I've added it to my explanation |
Yeah, I agree this behavior is not ideal. The RFC mentions that the behavior is explicitly chosen this way because it's unlikely to do what the user wants to and that it would raise awareness:
FWIW, this isn't specific to clippy. The linting framework entirely exists in rustc and the lint table is processed (and turned into command line arguments) by cargo. Clippy only extends the rust compiler with additional lints, so there is not much that can be done from the clippy side to fix this (ie builtin rustc lints have the same issue). The upstream issue over at cargo is rust-lang/cargo#12918 |
@szabgab also FYI (reading the post you linked now), you can run |
@y21 thanks. I am aware of |
Summary
Given this code:
I turned on
pedantic
inCargo.toml
and then wanted to turn off (allow) the individual lints so I can fix them one-by-one.I could turn off the
no_effect_underscore_binding
lint (and in a bigger application every other lint that was complaining), but not theuninlined_format_args
:When running on the command-line (with or without the section in
Cargo.toml
then everything is fine.Reproducer
No response
Version
The text was updated successfully, but these errors were encountered: