Another batch of clang-tidy fixes

This commit is contained in:
Konstantin Bogdanov 2024-10-16 18:18:52 +02:00
parent e88fe37d92
commit 4d0bc462a8
Signed by: thevar1able
GPG Key ID: DB399448D9FE52F1
8 changed files with 11 additions and 4 deletions

View File

@ -13,6 +13,7 @@ TEST(IColumn, dumpStructure)
String expected_structure = "LowCardinality(size = 0, UInt8(size = 0), Unique(size = 1, String(size = 1)))";
std::vector<std::thread> threads;
threads.reserve(6);
for (size_t i = 0; i < 6; ++i)
{
threads.emplace_back([&]

View File

@ -17,6 +17,8 @@ try
size_t num_threads = DB::parse<size_t>(argv[1]);
std::vector<std::thread> threads;
threads.reserve(num_threads);
for (size_t i = 0; i < num_threads; ++i)
{
threads.emplace_back([&]

View File

@ -150,6 +150,7 @@ TEST(Logger, SharedLoggersThreadSafety)
size_t loggers_size_before = names.size();
std::vector<std::thread> threads;
threads.reserve(threads_count);
for (size_t thread_index = 0; thread_index < threads_count; ++thread_index)
{

View File

@ -63,7 +63,7 @@ TEST_P(DateTime64StringWriteTest, WriteText)
EXPECT_NO_THROW(writeDateTimeText(param.dt64, param.scale, write_buffer, param.timezone));
write_buffer.finalize();
EXPECT_STREQ(param.string.data(), actual_string.data());
EXPECT_STREQ(param.string.data(), actual_string.data()); /// NOLINT(bugprone-suspicious-stringview-data-usage)
}
TEST_P(DateTime64StringParseBestEffortTest, parse)

View File

@ -117,7 +117,7 @@ TEST_P(FileEncryptionCipherTest, Encryption)
{
WriteBufferFromOwnString buf;
encryptor.setOffset(base_offset);
encryptor.encrypt(input.data(), i, buf);
encryptor.encrypt(input.data(), i, buf); /// NOLINT(bugprone-suspicious-stringview-data-usage)
ASSERT_EQ(expected.substr(0, i), buf.str());
}
}

View File

@ -146,6 +146,7 @@ TEST(PageCache, DISABLED_Stress)
auto start_time = std::chrono::steady_clock::now();
std::vector<std::thread> threads;
threads.reserve(num_threads);
for (size_t i = 0; i < num_threads; ++i)
threads.emplace_back(thread_func);
@ -247,6 +248,8 @@ TEST(PageCache, DISABLED_HitsBench)
auto start_time = std::chrono::steady_clock::now();
std::vector<std::thread> threads;
threads.reserve(num_threads);
for (size_t i = 0; i < num_threads; ++i)
threads.emplace_back(thread_func);

View File

@ -28,7 +28,7 @@ TEST(AsyncInsertsTest, testScatterOffsetsBySelector)
ASSERT_EQ(results.size(), expected.size());
for (size_t i = 0; i < results.size(); i++)
{
auto result = results[i];
const auto & result = results[i];
auto expect = expected[i];
ASSERT_EQ(result->offsets.size(), expect.size());
ASSERT_EQ(result->tokens.size(), expect.size());

View File

@ -70,7 +70,7 @@ uint64_t test(uint8_t * dst, uint8_t * src, size_t size, size_t iterations, size
iteration % 2 ? &dst[begin] : &src[begin],
end - begin,
[rng = RNG(), &generator]() mutable { return generator(rng); },
std::forward<MemcpyImpl>(impl)); /// NOLINT(bugprone-use-after-move)
std::forward<MemcpyImpl>(impl)); /// NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
}
});
}