Various plugins: Limit the usage of std::make_pair

Make the code less verbose.

Change-Id: I22ceb8d74567d78042f537b185f8e504227c24c6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-09-30 15:28:38 +02:00
parent 60d78e4bb0
commit f65c42c797
3 changed files with 6 additions and 6 deletions

View File

@@ -264,7 +264,7 @@ QnxConfiguration::QnxToolChainMap QnxConfiguration::createToolChain(const Target
toolChain->resetToolChain(qccCompilerPath()); toolChain->resetToolChain(qccCompilerPath());
ToolChainManager::registerToolChain(toolChain); ToolChainManager::registerToolChain(toolChain);
toolChainMap.insert(std::make_pair(language, toolChain)); toolChainMap.insert({language, toolChain});
} }
return toolChainMap; return toolChainMap;

View File

@@ -629,14 +629,14 @@ void QtOptionsPageWidget::addQtDir()
if (BuildableHelperLibrary::isQtChooser(qtVersion)) if (BuildableHelperLibrary::isQtChooser(qtVersion))
qtVersion = BuildableHelperLibrary::qtChooserToQmakePath(qtVersion.symLinkTarget()); qtVersion = BuildableHelperLibrary::qtChooserToQmakePath(qtVersion.symLinkTarget());
auto checkAlreadyExists = [qtVersion](TreeItem *parent) { auto checkAlreadyExists = [qtVersion](TreeItem *parent) -> QPair<bool, QString> {
for (int i = 0; i < parent->childCount(); ++i) { for (int i = 0; i < parent->childCount(); ++i) {
auto item = static_cast<QtVersionItem *>(parent->childAt(i)); auto item = static_cast<QtVersionItem *>(parent->childAt(i));
if (item->version()->qmakeFilePath() == qtVersion) { if (item->version()->qmakeFilePath() == qtVersion) {
return std::make_pair(true, item->version()->displayName()); return {true, item->version()->displayName()};
} }
} }
return std::make_pair(false, QString()); return {false, {}};
}; };
bool alreadyExists; bool alreadyExists;

View File

@@ -311,13 +311,13 @@ void tst_ImportCheck::moduleMapping_data()
QTest::newRow("check that QtQuick controls cannot be found with a mapping") QTest::newRow("check that QtQuick controls cannot be found with a mapping")
<< QString(TESTSRCDIR "/moduleMapping/importQtQuick.qml") << QString(TESTSRCDIR "/moduleMapping/importQtQuick.qml")
<< QString(TESTSRCDIR "/moduleMapping") << QString(TESTSRCDIR "/moduleMapping")
<< StrStrHash({ std::make_pair(QStringLiteral("QtQuick.Controls"), QStringLiteral("MyControls")) }) << StrStrHash({{QStringLiteral("QtQuick.Controls"), QStringLiteral("MyControls")}})
<< QStringList({ "Item", "Button" }) << QStringList({ "Item", "Button" })
<< false; << false;
QTest::newRow("check that custom controls can be found with a mapping") QTest::newRow("check that custom controls can be found with a mapping")
<< QString(TESTSRCDIR "/moduleMapping/importQtQuick.qml") << QString(TESTSRCDIR "/moduleMapping/importQtQuick.qml")
<< QString(TESTSRCDIR "/moduleMapping") << QString(TESTSRCDIR "/moduleMapping")
<< StrStrHash({ std::make_pair(QStringLiteral("QtQuick.Controls"), QStringLiteral("MyControls")) }) << StrStrHash({{QStringLiteral("QtQuick.Controls"), QStringLiteral("MyControls")}})
<< QStringList({ "Item", "Oblong" }) // item is in QtQuick, and should still be found, as only << QStringList({ "Item", "Oblong" }) // item is in QtQuick, and should still be found, as only
// the QtQuick.Controls are redirected // the QtQuick.Controls are redirected
<< true; << true;