tst_bench_qlocalsocket: fix Clang 10 warnings about unneeded capture

The timeToTest constant doesn't need to be captured, claims Clang.

Since I don't recall seeing this warning on GCC, be pragmatic and fix
by letting the compiler choose what to capture: [&]. timeToTest is
const, so it doesn't matter whether we capture by reference or value,
the lambda cannot change it either way.

This code doesn't seem to exist in 5.15, so merely

Pick-to: 6.3 6.2
Change-Id: I48d42ab13ed22ac5eb512dc61235b72a19636ea3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2022-01-22 21:34:46 +01:00
parent b084c885db
commit c00e443dcc

View File

@ -212,8 +212,7 @@ void tst_QLocalSocket::dataExchange()
qint64 totalReceived = 0;
QElapsedTimer timer;
connect(&factory, &SocketFactory::bytesReceived,
[&totalReceived, &timer, timeToTest, &factory, &eventLoop](int channel, qint64 bytes) {
connect(&factory, &SocketFactory::bytesReceived, [&](int channel, qint64 bytes) {
Q_UNUSED(channel);
totalReceived += bytes;