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() + "/.."));
|
||||
}
|
||||
|
||||
static QStringList filterLinks(const QStringList &list)
|
||||
static QStringList filterLinks(QStringList &&list)
|
||||
{
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
return list;
|
||||
#else
|
||||
QStringList result;
|
||||
foreach (QString str, list) {
|
||||
if (!str.endsWith(QLatin1String(".lnk")))
|
||||
result.append(str);
|
||||
}
|
||||
return result;
|
||||
#ifdef Q_NO_SYMLINKS
|
||||
auto isDotLnk = [](const auto &s) { return s.endsWith(".lnk"_L1); };
|
||||
list.removeIf(isDotLnk);
|
||||
#endif
|
||||
return std::move(list);
|
||||
}
|
||||
|
||||
void tst_QDir::entryList_data()
|
||||
|
Loading…
x
Reference in New Issue
Block a user