CppEditor: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: I9915cf2c07bdcc570efc20601752d60f2ec82f34
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-05-05 13:44:45 +02:00
parent 556ec7c20e
commit 7e69b64b74
12 changed files with 102 additions and 79 deletions

View File

@@ -277,7 +277,7 @@ void CompletionTest::testCompletionTemplateFunction()
QStringList actualCompletions = test.getCompletions();
QString errorPattern(QLatin1String("Completion not found: %1"));
foreach (const QString &completion, expectedCompletions) {
for (const QString &completion : qAsConst(expectedCompletions)) {
QByteArray errorMessage = errorPattern.arg(completion).toUtf8();
QVERIFY2(actualCompletions.contains(completion), errorMessage.data());
}
@@ -371,7 +371,7 @@ void CompletionTest::testGlobalCompletion_data()
"<REPLACEMENT>\n"
"@\n";
const QStringList replacements = QStringList({"// text", "// text.", "/// text", "/// text."});
foreach (const QString &replacement, replacements) {
for (const QString &replacement : replacements) {
QByteArray code = codeTemplate;
code.replace("<REPLACEMENT>", replacement.toUtf8());
const QByteArray tag = _("completion after comment: ") + replacement.toUtf8();