hyper for a long time never bothered with clippy. Mostly for historical reasons and opinions.
I've now come around to just turning clippy up to 11. What I'm currently leaning towards is keeping an allowlist, and otherwise denying pedantic and even restriction lints. Yes, I know there's a restriction lint against linting for the restriction group. An allowlist still makes a lot of sense to me. If after a bit it turns out to be just unbearable, we can convert it to a bigger deny list, I guess.
The initial config is in place, with a CI job that enforce it, so we won't regress with new code. Now, we just need to evaluate all the undecided lints, and either choose to allow them for sure, or fix them.
How to help
Look at the list of lints that need to be decided upon in the Cargo.toml (it's around there, the line might move slightly).
- Pick a lint.
- If it seems obviously an improvement:
- Fix up the code from the lint.
- It might be as simple as
cargo clippy --fix --features full.
- It might be obvious enough for an LLM to automate fixing. (But only if you understand what changes it made.)
- It might need manual adjustment in each case.
- It might need to be
#[allow(this_lint)] in specific cases, where the lint is usually useful.
- Remove the allowed lint from the
Cargo.toml
- Submit a PR for one lint at a time.
- If it is not obviously an improvement:
- Move the lint down lower to the explicitly allowed list in the
Cargo.toml
- Add a comment why the lint is being allowed
- Submit a PR (multiple lints solved this way is fine in a single PR)
Steps
hyper for a long time never bothered with clippy. Mostly for historical reasons and opinions.
I've now come around to just turning clippy up to 11. What I'm currently leaning towards is keeping an allowlist, and otherwise denying
pedanticand evenrestrictionlints. Yes, I know there's a restriction lint against linting for the restriction group. An allowlist still makes a lot of sense to me. If after a bit it turns out to be just unbearable, we can convert it to a bigger deny list, I guess.The initial config is in place, with a CI job that enforce it, so we won't regress with new code. Now, we just need to evaluate all the undecided lints, and either choose to allow them for sure, or fix them.
How to help
Look at the list of lints that need to be decided upon in the Cargo.toml (it's around there, the line might move slightly).
cargo clippy --fix --features full.#[allow(this_lint)]in specific cases, where the lint is usually useful.Cargo.tomlCargo.tomlSteps