Enable lints for tests only running optimized#6664
Merged
mergify[bot] merged 9 commits intosigp:unstablefrom Dec 17, 2024
Merged
Enable lints for tests only running optimized#6664mergify[bot] merged 9 commits intosigp:unstablefrom
mergify[bot] merged 9 commits intosigp:unstablefrom
Conversation
Collaborator
|
This is a great addition! |
michaelsproul
approved these changes
Dec 16, 2024
Member
michaelsproul
left a comment
There was a problem hiding this comment.
Looks great, thanks!
Regarding await_holding_lock I think it would be good to fix all of these occurrences eventually, as they could lead to flaky tests/random deadlocks. I think the easiest way to do it is to swap the lock out for a tokio one, which makes the lock acquisition itself async.
The only reason we have this lint allow'd in the VC is that it never seems to have caused problems in practice, and it would be a decently complicated refactor to make that lock async.
Member
|
Merging this now before it gets into conflict with too many other PRs |
Member
|
@mergify queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 02cb2d6 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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--releasemode to save time.Proposed Changes
This PR enables linting these tests by setting the compiler option
-C debug-assertions=nowhen 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_optionsby 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 asNaiveAggregationPoolis notCloneable, 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 theNonebranch was now empty. I pulled the check out of thematchand then applied the lint suggestion. (edit: By accident, I flipped the condition which I fixed in a later commit)Box::pinaround some of the invoked futures, and split up the test in one case.