Enable lints for tests only running optimized #6664
+576
−578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Previously, tests gated with
#[cfg(not(debug_assertions))]
were not linted, as Clippy does not run in--release
mode to save time.Proposed Changes
This PR enables linting these tests by setting the compiler option
-C debug-assertions=no
when invoking Clippy. This retains the time saved by not optimizing while linting. Also, this PR fixes allllll the lint errors uncovered by this.Additional Info
For easier review, this PR is split into several commits:
&
or.into()
s). Some errors were not machine fixable but really obvious to fix anyway (at my discretion). Feel free to scroll through this anyway. I checked machine fixable occurrences manually to make sure they're sane.suspicious_open_options
by removing manual options: Here I modified the code beyond the scope of the lint to make it a bit nicer, but that is a matter of taste.await_holding_locks
: Here we held locks across await points, so I had to shuffle things around a bit. In one case, it was annoying to avoid asNaiveAggregationPool
is notClone
able, so I disabled the lint here (as there is some precedent for that in the codebase). (edit: I now realize one lock is used for inter-test ratelimiting, so I reverted and disabled the lint there in a later commit)#[cfg(debug_assertions)]
: This one is interesting: The newly set compiler flag caused an issue in this non-test code as theNone
branch was now empty. I pulled the check out of thematch
and then applied the lint suggestion. (edit: By accident, I flipped the condition which I fixed in a later commit)Box::pin
around some of the invoked futures, and split up the test in one case.