Various Plugins: Simplify return QStringList statements

Amends 925bb2ca31

Change-Id: I57bee33cb7acd0ab1cdcfb6897a4847b912b4c97
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2023-08-02 08:01:11 +02:00
parent e9721641fc
commit 82712e12f8
14 changed files with 21 additions and 26 deletions

View File

@@ -827,7 +827,7 @@ FindExportedCppTypes::FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot)
QStringList FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document) QStringList FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
{ {
QTC_ASSERT(!document.isNull(), return QStringList()); QTC_ASSERT(!document.isNull(), return {});
m_contextProperties.clear(); m_contextProperties.clear();
m_exportedTypes.clear(); m_exportedTypes.clear();

View File

@@ -63,7 +63,7 @@ DropSupport::DropSupport(QWidget *parentWidget, const DropFilterFunction &filter
QStringList DropSupport::mimeTypesForFilePaths() QStringList DropSupport::mimeTypesForFilePaths()
{ {
return QStringList("text/uri-list"); return {"text/uri-list"};
} }
bool DropSupport::isFileDrop(QDropEvent *event) bool DropSupport::isFileDrop(QDropEvent *event)

View File

@@ -252,7 +252,7 @@ QStringList JsonSchema::properties(JsonObjectValue *v) const
QStringList JsonSchema::properties() const QStringList JsonSchema::properties() const
{ {
QTC_ASSERT(acceptsType(JsonValue::kindToString(JsonValue::Object)), return QStringList()); QTC_ASSERT(acceptsType(JsonValue::kindToString(JsonValue::Object)), return {});
return properties(currentValue()); return properties(currentValue());
} }

View File

@@ -223,7 +223,7 @@ MimeType MimeDatabasePrivate::mimeTypeForName(const QString &nameOrAlias)
QStringList MimeDatabasePrivate::mimeTypeForFileName(const QString &fileName) QStringList MimeDatabasePrivate::mimeTypeForFileName(const QString &fileName)
{ {
if (fileName.endsWith(QLatin1Char('/'))) if (fileName.endsWith(QLatin1Char('/')))
return QStringList() << QLatin1String("inode/directory"); return {"inode/directory"};
const MimeGlobMatchResult result = findByFileName(fileName); const MimeGlobMatchResult result = findByFileName(fileName);
QStringList matchingMimeTypes = result.m_matchingMimeTypes; QStringList matchingMimeTypes = result.m_matchingMimeTypes;

View File

@@ -12,8 +12,8 @@ namespace Android {
QStringList AndroidDeviceInfo::adbSelector(const QString &serialNumber) QStringList AndroidDeviceInfo::adbSelector(const QString &serialNumber)
{ {
if (serialNumber.startsWith(QLatin1String("????"))) if (serialNumber.startsWith(QLatin1String("????")))
return QStringList("-d"); return {"-d"};
return QStringList({"-s", serialNumber}); return {"-s", serialNumber};
} }
bool AndroidDeviceInfo::operator<(const AndroidDeviceInfo &other) const bool AndroidDeviceInfo::operator<(const AndroidDeviceInfo &other) const

View File

@@ -99,13 +99,13 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted,
if (knownAllowedOptionsWithParameter.contains(currentOpt)) { if (knownAllowedOptionsWithParameter.contains(currentOpt)) {
allowed.append(currentOpt); allowed.append(currentOpt);
++it; ++it;
QTC_ASSERT(it != end, return QStringList()); QTC_ASSERT(it != end, return {});
allowed.append(*it); allowed.append(*it);
} else if (knownInterferingOptionWithParameter.contains(currentOpt)) { } else if (knownInterferingOptionWithParameter.contains(currentOpt)) {
if (omitted) { if (omitted) {
omitted->append(currentOpt); omitted->append(currentOpt);
++it; ++it;
QTC_ASSERT(it != end, return QStringList()); QTC_ASSERT(it != end, return {});
omitted->append(*it); omitted->append(*it);
} }
} else if (knownInterferingSingleOptions.contains(currentOpt)) { } else if (knownInterferingSingleOptions.contains(currentOpt)) {
@@ -115,7 +115,7 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted,
if (knownAllowedQuickOptionsWithParameter.contains(currentOpt)) { if (knownAllowedQuickOptionsWithParameter.contains(currentOpt)) {
allowed.append(currentOpt); allowed.append(currentOpt);
++it; ++it;
QTC_ASSERT(it != end, return QStringList()); QTC_ASSERT(it != end, return {});
allowed.append(*it); allowed.append(*it);
} else if (knownAllowedSingleQuickOptions.contains(currentOpt)) { } else if (knownAllowedSingleQuickOptions.contains(currentOpt)) {
allowed.append(currentOpt); allowed.append(currentOpt);

View File

@@ -192,7 +192,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
QStringList ExternalToolModel::mimeTypes() const QStringList ExternalToolModel::mimeTypes() const
{ {
return QStringList("application/qtcreator-externaltool-config"); return {"application/qtcreator-externaltool-config"};
} }
QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &parent) const QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &parent) const

View File

@@ -129,11 +129,11 @@ FilePath IosDsymBuildStep::defaultCommand() const
QStringList IosDsymBuildStep::defaultCleanCmdList() const QStringList IosDsymBuildStep::defaultCleanCmdList() const
{ {
auto runConf = qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration()); auto runConf = qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
QTC_ASSERT(runConf, return QStringList("echo")); QTC_ASSERT(runConf, return {"echo"});
QString dsymPath = runConf->bundleDirectory().toUserOutput(); QString dsymPath = runConf->bundleDirectory().toUserOutput();
dsymPath.chop(4); dsymPath.chop(4);
dsymPath.append(".dSYM"); dsymPath.append(".dSYM");
return QStringList({"rm", "-rf", dsymPath}); return {"rm", "-rf", dsymPath};
} }
QStringList IosDsymBuildStep::defaultCmdList() const QStringList IosDsymBuildStep::defaultCmdList() const
@@ -144,11 +144,11 @@ QStringList IosDsymBuildStep::defaultCmdList() const
if (dsymUtilPath.exists()) if (dsymUtilPath.exists())
dsymutilCmd = dsymUtilPath.toUserOutput(); dsymutilCmd = dsymUtilPath.toUserOutput();
auto runConf = qobject_cast<const IosRunConfiguration *>(target()->activeRunConfiguration()); auto runConf = qobject_cast<const IosRunConfiguration *>(target()->activeRunConfiguration());
QTC_ASSERT(runConf, return QStringList("echo")); QTC_ASSERT(runConf, return {"echo"});
QString dsymPath = runConf->bundleDirectory().toUserOutput(); QString dsymPath = runConf->bundleDirectory().toUserOutput();
dsymPath.chop(4); dsymPath.chop(4);
dsymPath.append(".dSYM"); dsymPath.append(".dSYM");
return QStringList({dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput()}); return {dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput()};
} }
FilePath IosDsymBuildStep::command() const FilePath IosDsymBuildStep::command() const

View File

@@ -167,7 +167,7 @@ bool QmakePriFileNode::removeSubProject(const FilePath &proFilePath)
QStringList QmakePriFileNode::subProjectFileNamePatterns() const QStringList QmakePriFileNode::subProjectFileNamePatterns() const
{ {
return QStringList("*.pro"); return {"*.pro"};
} }
bool QmakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FilePaths *notAdded) bool QmakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FilePaths *notAdded)

View File

@@ -381,7 +381,7 @@ QStringList QMakeStep::parserArguments()
// NOTE: extra parser args placed before the other args intentionally // NOTE: extra parser args placed before the other args intentionally
QStringList result = m_extraParserArgs; QStringList result = m_extraParserArgs;
QtVersion *qt = QtKitAspect::qtVersion(kit()); QtVersion *qt = QtKitAspect::qtVersion(kit());
QTC_ASSERT(qt, return QStringList()); QTC_ASSERT(qt, return {});
for (ProcessArgs::ConstArgIterator ait(allArguments(qt, ArgumentFlag::Expand)); ait.next(); ) { for (ProcessArgs::ConstArgIterator ait(allArguments(qt, ArgumentFlag::Expand)); ait.next(); ) {
if (ait.isSimple()) if (ait.isSimple())
result << ait.value(); result << ait.value();

View File

@@ -121,11 +121,7 @@ QStringList QmlProfilerStatisticsModel::details(int typeIndex) const
data = data.left(maxColumnWidth - 1) + ellipsisChar; data = data.left(maxColumnWidth - 1) + ellipsisChar;
} }
return QStringList({ return {displayName, data, QString::number(durationPercent(typeIndex), 'f', 2) + '%'};
displayName,
data,
QString::number(durationPercent(typeIndex), 'f', 2) + QLatin1Char('%')
});
} }
QString QmlProfilerStatisticsModel::summary(const QVector<int> &typeIds) const QString QmlProfilerStatisticsModel::summary(const QVector<int> &typeIds) const

View File

@@ -2143,7 +2143,7 @@ static QStringList extractFieldsFromBuildString(const QByteArray &buildString)
result.append(abiInfo.takeFirst()); // cpu result.append(abiInfo.takeFirst()); // cpu
const QString endian = abiInfo.takeFirst(); const QString endian = abiInfo.takeFirst();
QTC_ASSERT(endian.endsWith("_endian"), return QStringList()); QTC_ASSERT(endian.endsWith("_endian"), return {});
result.append(endian.left(endian.size() - 7)); // without the "_endian" result.append(endian.left(endian.size() - 7)); // without the "_endian"
result.append(abiInfo.takeFirst()); // pointer result.append(abiInfo.takeFirst()); // pointer

View File

@@ -68,10 +68,9 @@ Utils::FilePath QScxmlcGenerator::command() const
QStringList QScxmlcGenerator::arguments() const QStringList QScxmlcGenerator::arguments() const
{ {
QTC_ASSERT(!m_header.isEmpty(), return QStringList()); QTC_ASSERT(!m_header.isEmpty(), return {});
return QStringList({QLatin1String("--header"), m_header, QLatin1String("--impl"), m_impl, return {"--header", m_header, "--impl", m_impl, tmpFile().fileName()};
tmpFile().fileName()});
} }
Utils::FilePath QScxmlcGenerator::workingDirectory() const Utils::FilePath QScxmlcGenerator::workingDirectory() const

View File

@@ -346,7 +346,7 @@ void ObjectsMapModel::removeSymbolicName(const QModelIndex &idx)
QStringList ObjectsMapModel::allSymbolicNames() const QStringList ObjectsMapModel::allSymbolicNames() const
{ {
TreeItem *root = rootItem(); TreeItem *root = rootItem();
QTC_ASSERT(root, return QStringList()); QTC_ASSERT(root, return {});
QMap<QString, PropertyList> objects; QMap<QString, PropertyList> objects;
forAllItems([&objects](ObjectsMapTreeItem *item) { forAllItems([&objects](ObjectsMapTreeItem *item) {