tst_QDir: port Q_FOREACH with QList::removeIf
filterLinks() is always called on a temporary QStringList, so make it take by && (which proves it's always called on a temporary), and modify the parameter directly. Task-number: QTBUG-115839 Change-Id: I40611f40cc0096a58d5c9d8e68c5df06d43152e5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
645dcc27d3
commit
9812df02db
@ -717,18 +717,13 @@ void tst_QDir::compare()
|
|||||||
QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/.."));
|
QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/.."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList filterLinks(const QStringList &list)
|
static QStringList filterLinks(QStringList &&list)
|
||||||
{
|
{
|
||||||
#ifndef Q_NO_SYMLINKS
|
#ifdef Q_NO_SYMLINKS
|
||||||
return list;
|
auto isDotLnk = [](const auto &s) { return s.endsWith(".lnk"_L1); };
|
||||||
#else
|
list.removeIf(isDotLnk);
|
||||||
QStringList result;
|
|
||||||
foreach (QString str, list) {
|
|
||||||
if (!str.endsWith(QLatin1String(".lnk")))
|
|
||||||
result.append(str);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
#endif
|
#endif
|
||||||
|
return std::move(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDir::entryList_data()
|
void tst_QDir::entryList_data()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user