clang-tidy, test: Fix bugprone-use-after-move in Correct_Queue_range()

This commit is contained in:
Hennadii Stepanov 2023-03-21 13:04:12 +00:00
parent 04831fee6d
commit 9a0b524139
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -184,12 +184,14 @@ static void Correct_Queue_range(std::vector<size_t> range)
small_queue->StartWorkerThreads(SCRIPT_CHECK_THREADS);
// Make vChecks here to save on malloc (this test can be slow...)
std::vector<FakeCheckCheckCompletion> vChecks;
vChecks.reserve(9);
for (const size_t i : range) {
size_t total = i;
FakeCheckCheckCompletion::n_calls = 0;
CCheckQueueControl<FakeCheckCheckCompletion> control(small_queue.get());
while (total) {
vChecks.resize(std::min(total, (size_t) InsecureRandRange(10)));
vChecks.clear();
vChecks.resize(std::min<size_t>(total, InsecureRandRange(10)));
total -= vChecks.size();
control.Add(std::move(vChecks));
}