pyo3
pyo3 copied to clipboard
Enable some Clippy lints
Hello! This PR enables some Clippy lints and fixes all the warnings. There is one lint enabled per commit (except for the pyo3-macros
) one, so I would suggest reviewing the commits one at a time. The changes all seem reasonable, and hopefully not too intrusive. It doesn't do pyo3-macros-backend
, but I can add that too if that's wanted.
I think it might be better to open a PR for each lint. That would make it easier to say "yes we want this" or "no we don't want this" on a case-by-case basis.
Finally, for this to land, we'll need to fix the lints for all CI builds.
I dropped the const and semicolon lints, since those changed a lot of lines and were both failing in CI (hard to check locally because of all the various config flags). I can still break up the remaining commits if you like, but I think it should be a lot more manageable now.
I didn't realize there was such deviation between a local run and a CI run :face_with_spiral_eyes:
I didn't realize there was such deviation between a local run and a CI run 😵💫
You can reproduce most of that locally using the Nox sessions which e.g. enumerate feature sets.
For example, the
missing_const_for_fn
lint is explicitly in development and has a bunch of caveats.
Especially since what could be const
today may not be able to be const
tomorrow. IMO it's a bit irresponsible of Clippy to integrate such lints that encourage API breaking or major-version inflation, seeing as how people tend to apply its suggestions without much critical thinking (which, in many cases, is justified).
Edit: I see it's allow-by-default. That makes more sense, and once it's out of the nursery it will probably go to a lint group that we definitely don't want to have in a sweeping #[deny]
.
I'm still not convinced we necessarily want all of these, so I'd prefer to have them as separate PRs.