diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 98fff3472dc..8f3e66e9824 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -152,7 +152,7 @@ AutotestPluginPrivate::AutotestPluginPrivate() this, [this] { m_runconfigCache.clear(); }); connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject, - this, [] (ProjectExplorer::Project *project) { + this, [](ProjectExplorer::Project *project) { const auto it = s_projectSettings.constFind(project); if (it != s_projectSettings.constEnd()) { delete it.value(); diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp index 231dea01ff2..124457c6851 100644 --- a/src/plugins/autotest/gtest/gtestconfiguration.cpp +++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp @@ -37,8 +37,8 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted) "--gtest_print_time=" }; - QStringList allowed = Utils::filtered(provided, [] (const QString &arg) { - return Utils::allOf(knownInterferingOptions, [&arg] (const QString &interfering) { + QStringList allowed = Utils::filtered(provided, [](const QString &arg) { + return Utils::allOf(knownInterferingOptions, [&arg](const QString &interfering) { return !arg.startsWith(interfering); }); }); diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp index 799ae33a15b..ba52e18f1bc 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.cpp +++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp @@ -511,7 +511,7 @@ QSet internalTargets(const TestTreeItem &item) return cppMM->dependingInternalTargets(item.filePath()); for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectParts) { if (Utils::FilePath::fromString(projectPart->projectFile) == item.proFile() - && Utils::anyOf(projectPart->files, [&file] (const CppEditor::ProjectFile &pf) { + && Utils::anyOf(projectPart->files, [&file](const CppEditor::ProjectFile &pf) { return pf.path == file; })) { result.insert(projectPart->buildSystemTarget); diff --git a/src/plugins/autotest/projectsettingswidget.cpp b/src/plugins/autotest/projectsettingswidget.cpp index e85ac6977c0..733042612e8 100644 --- a/src/plugins/autotest/projectsettingswidget.cpp +++ b/src/plugins/autotest/projectsettingswidget.cpp @@ -86,8 +86,7 @@ ProjectTestSettingsWidget::ProjectTestSettingsWidget(ProjectExplorer::Project *p m_projectSettings->setRunAfterBuild(RunAfterBuildMode(index)); }); m_syncTimer.setSingleShot(true); - connect(&m_syncTimer, &QTimer::timeout, - [this]() { + connect(&m_syncTimer, &QTimer::timeout, this, [this] { auto testTreeModel = TestTreeModel::instance(); if (m_syncType & ITestBase::Framework) testTreeModel->synchronizeTestFrameworks(); diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp index ce2c297ba9a..746a8b40df0 100644 --- a/src/plugins/autotest/qtest/qttestparser.cpp +++ b/src/plugins/autotest/qtest/qttestparser.cpp @@ -76,7 +76,7 @@ static bool qtTestLibDefined(const Utils::FilePath &fileName) const QList parts = CppEditor::CppModelManager::instance()->projectPart(fileName); if (parts.size() > 0) { - return Utils::anyOf(parts.at(0)->projectMacros, [] (const ProjectExplorer::Macro ¯o) { + return Utils::anyOf(parts.at(0)->projectMacros, [](const ProjectExplorer::Macro ¯o) { return macro.key == "QT_TESTLIB_LIB"; }); } @@ -218,7 +218,7 @@ static bool containsFunction(const QMap &tes const QString &function) { const QString search = "::" + function; - return Utils::anyOf(testFunctions.keys(), [&search] (const QString &key) { + return Utils::anyOf(testFunctions.keys(), [&search](const QString &key) { return key.endsWith(search); }); } diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index 6c4e3158e25..072dafca2f0 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -83,20 +83,20 @@ static QString quickTestSrcDir(const CppEditor::CppModelManager *cppMM, const QList parts = cppMM->projectPart(fileName); if (parts.size() > 0) { const ProjectExplorer::Macros ¯os = parts.at(0)->projectMacros; - auto found = std::find_if( - macros.cbegin(), - macros.cend(), - [] (const ProjectExplorer::Macro ¯o) { return macro.key == "QUICK_TEST_SOURCE_DIR"; }); - if (found != macros.cend()) { - QByteArray result = found->value; - if (result.startsWith('"')) - result.remove(result.length() - 1, 1).remove(0, 1); - if (result.startsWith("\\\"")) - result.remove(result.length() - 2, 2).remove(0, 2); - return QLatin1String(result); - } + auto found = std::find_if(macros.cbegin(), macros.cend(), + [](const ProjectExplorer::Macro ¯o) { + return macro.key == "QUICK_TEST_SOURCE_DIR"; + }); + if (found != macros.cend()) { + QByteArray result = found->value; + if (result.startsWith('"')) + result.remove(result.length() - 1, 1).remove(0, 1); + if (result.startsWith("\\\"")) + result.remove(result.length() - 2, 2).remove(0, 2); + return QLatin1String(result); + } } - return QString(); + return {}; } QString QuickTestParser::quickTestName(const CPlusPlus::Document::Ptr &doc) const @@ -326,7 +326,7 @@ QuickTestParser::QuickTestParser(ITestFramework *framework) : CppParser(framework) { connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::startupProjectChanged, [this] { + &ProjectExplorer::SessionManager::startupProjectChanged, this, [this] { const QStringList &dirs = m_directoryWatcher.directories(); if (!dirs.isEmpty()) m_directoryWatcher.removePaths(dirs); diff --git a/src/plugins/autotest/quick/quicktestvisitors.cpp b/src/plugins/autotest/quick/quicktestvisitors.cpp index 198077bf03e..f9023e8131d 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.cpp +++ b/src/plugins/autotest/quick/quicktestvisitors.cpp @@ -27,7 +27,7 @@ TestQmlVisitor::TestQmlVisitor(QmlJS::Document::Ptr doc, const QmlJS::Snapshot & static bool documentImportsQtTest(const QmlJS::Document *doc) { if (const QmlJS::Bind *bind = doc->bind()) { - return Utils::anyOf(bind->imports(), [] (const QmlJS::ImportInfo &info) { + return Utils::anyOf(bind->imports(), [](const QmlJS::ImportInfo &info) { return info.isValid() && info.name() == "QtTest"; }); } diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index 8edfea8a262..2e1be96235e 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -46,7 +46,7 @@ TestCodeParser::TestCodeParser() connect(&m_futureWatcher, &QFutureWatcher::finished, this, &TestCodeParser::onFinished); connect(&m_futureWatcher, &QFutureWatcher::resultReadyAt, - this, [this] (int index) { + this, [this](int index) { emit testParseResultReady(m_futureWatcher.resultAt(index)); }); connect(this, &TestCodeParser::parsingFinished, this, &TestCodeParser::releaseParserInternals); @@ -112,7 +112,7 @@ void TestCodeParser::emitUpdateTestTree(ITestParser *parser) qCDebug(LOG) << "adding singleShot"; m_singleShotScheduled = true; - QTimer::singleShot(1000, this, [this]() { updateTestTree(m_updateParsers); }); + QTimer::singleShot(1000, this, [this] { updateTestTree(m_updateParsers); }); } void TestCodeParser::updateTestTree(const QSet &parsers) @@ -310,7 +310,7 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, TestTreeModel::instance()->updateCheckStateCache(); if (isFullParse) { // remove qml files as they will be found automatically by the referencing cpp file - list = Utils::filtered(list, [] (const Utils::FilePath &fn) { + list = Utils::filtered(list, [](const Utils::FilePath &fn) { return !fn.endsWith(".qml"); }); if (!parsers.isEmpty()) { diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp index c6cb1ae4ee2..5007bea0a77 100644 --- a/src/plugins/autotest/testnavigationwidget.cpp +++ b/src/plugins/autotest/testnavigationwidget.cpp @@ -84,8 +84,7 @@ TestNavigationWidget::TestNavigationWidget(QWidget *parent) : this, &TestNavigationWidget::onParsingFinished); connect(m_model->parser(), &TestCodeParser::parsingFailed, this, &TestNavigationWidget::onParsingFinished); - connect(m_model, &TestTreeModel::updatedActiveFrameworks, - this, [this] (int numberOfActive) { + connect(m_model, &TestTreeModel::updatedActiveFrameworks, this, [this](int numberOfActive) { m_missingFrameworksWidget->setVisible(numberOfActive == 0); }); ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance(); @@ -122,14 +121,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) if (item->canProvideTestConfiguration()) { runThisTest = new QAction(Tr::tr("Run This Test"), &menu); runThisTest->setEnabled(enabled); - connect(runThisTest, &QAction::triggered, - this, [this] () { + connect(runThisTest, &QAction::triggered, this, [this] { onRunThisTestTriggered(TestRunMode::Run); }); runWithoutDeploy = new QAction(Tr::tr("Run Without Deployment"), &menu); runWithoutDeploy->setEnabled(enabled); - connect(runWithoutDeploy, &QAction::triggered, - this, [this] () { + connect(runWithoutDeploy, &QAction::triggered, this, [this] { onRunThisTestTriggered(TestRunMode::RunWithoutDeploy); }); } @@ -139,14 +136,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) if (ttitem && ttitem->canProvideDebugConfiguration()) { debugThisTest = new QAction(Tr::tr("Debug This Test"), &menu); debugThisTest->setEnabled(enabled); - connect(debugThisTest, &QAction::triggered, - this, [this] () { + connect(debugThisTest, &QAction::triggered, this, [this] { onRunThisTestTriggered(TestRunMode::Debug); }); debugWithoutDeploy = new QAction(Tr::tr("Debug Without Deployment"), &menu); debugWithoutDeploy->setEnabled(enabled); - connect(debugWithoutDeploy, &QAction::triggered, - this, [this] () { + connect(debugWithoutDeploy, &QAction::triggered, this, [this] { onRunThisTestTriggered(TestRunMode::DebugWithoutDeploy); }); } @@ -216,13 +211,13 @@ QList TestNavigationWidget::createToolButtons() collapse->setIcon(Utils::Icons::COLLAPSE_TOOLBAR.icon()); collapse->setToolTip(Tr::tr("Collapse All")); - connect(expand, &QToolButton::clicked, m_view, [this]() { + connect(expand, &QToolButton::clicked, m_view, [this] { m_view->blockSignals(true); m_view->expandAll(); m_view->blockSignals(false); updateExpandedStateCache(); }); - connect(collapse, &QToolButton::clicked, m_view, [this]() { + connect(collapse, &QToolButton::clicked, m_view, [this] { m_view->blockSignals(true); m_view->collapseAll(); m_view->blockSignals(false); diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 22200f4e473..f2e0ce1196c 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -135,10 +135,10 @@ TestResultsPane::TestResultsPane(QObject *parent) : trd, &TestResultDelegate::currentChanged); connect(m_treeView, &Utils::TreeView::customContextMenuRequested, this, &TestResultsPane::onCustomContextMenuRequested); - connect(m_treeView, &ResultsTreeView::copyShortcutTriggered, [this] () { + connect(m_treeView, &ResultsTreeView::copyShortcutTriggered, this, [this] { onCopyItemTriggered(getTestResult(m_treeView->currentIndex())); }); - connect(m_model, &TestResultModel::requestExpansion, [this] (const QModelIndex &idx) { + connect(m_model, &TestResultModel::requestExpansion, this, [this](const QModelIndex &idx) { m_treeView->expand(m_filterModel->mapFromSource(idx)); }); connect(TestRunner::instance(), &TestRunner::testRunStarted, @@ -159,7 +159,7 @@ void TestResultsPane::createToolButtons() m_expandCollapse->setToolTip(Tr::tr("Expand All")); m_expandCollapse->setCheckable(true); m_expandCollapse->setChecked(false); - connect(m_expandCollapse, &QToolButton::clicked, [this] (bool checked) { + connect(m_expandCollapse, &QToolButton::clicked, this, [this](bool checked) { if (checked) m_treeView->expandAll(); else @@ -505,10 +505,10 @@ void TestResultsPane::initializeFilterMenu() m_filterMenu->addSeparator(); QAction *action = new QAction(Tr::tr("Check All Filters"), m_filterMenu); m_filterMenu->addAction(action); - connect(action, &QAction::triggered, this, [this]() { TestResultsPane::checkAllFilter(true); }); + connect(action, &QAction::triggered, this, [this] { TestResultsPane::checkAllFilter(true); }); action = new QAction(Tr::tr("Uncheck All Filters"), m_filterMenu); m_filterMenu->addAction(action); - connect(action, &QAction::triggered, this, [this]() { TestResultsPane::checkAllFilter(false); }); + connect(action, &QAction::triggered, this, [this] { TestResultsPane::checkAllFilter(false); }); } void TestResultsPane::updateSummaryLabel() @@ -617,7 +617,7 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos) QAction *action = new QAction(Tr::tr("Copy"), &menu); action->setShortcut(QKeySequence(QKeySequence::Copy)); action->setEnabled(resultsAvailable && clicked); - connect(action, &QAction::triggered, [this, clicked] () { + connect(action, &QAction::triggered, this, [this, clicked] { onCopyItemTriggered(clicked); }); menu.addAction(action); diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 0eeba0f6d7d..4d11df746ec 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -71,15 +71,14 @@ TestRunner::TestRunner() s_instance = this; m_cancelTimer.setSingleShot(true); - connect(&m_cancelTimer, &QTimer::timeout, this, [this]() { cancelCurrent(Timeout); }); + connect(&m_cancelTimer, &QTimer::timeout, this, [this] { cancelCurrent(Timeout); }); connect(&m_futureWatcher, &QFutureWatcher::resultReadyAt, this, [this](int index) { emit testResultReady(m_futureWatcher.resultAt(index)); }); connect(&m_futureWatcher, &QFutureWatcher::finished, this, &TestRunner::onFinished); connect(this, &TestRunner::requestStopTestRun, &m_futureWatcher, &QFutureWatcher::cancel); - connect(&m_futureWatcher, &QFutureWatcher::canceled, - this, [this]() { + connect(&m_futureWatcher, &QFutureWatcher::canceled, this, [this] { cancelCurrent(UserCanceled); reportResult(ResultType::MessageFatal, Tr::tr("Test run canceled by user.")); }); @@ -386,7 +385,7 @@ void TestRunner::prepareToRunTests(TestRunMode mode) } m_targetConnect = connect(project, &Project::activeTargetChanged, - [this]() { cancelCurrent(KitChanged); }); + this, [this] { cancelCurrent(KitChanged); }); if (projectExplorerSettings.buildBeforeDeploy == ProjectExplorer::Internal::BuildBeforeRunMode::Off || mode == TestRunMode::DebugWithoutDeploy @@ -423,14 +422,14 @@ static RunConfiguration *getRunConfiguration(const QString &buildTargetKey) RunConfiguration *runConfig = nullptr; const QList runConfigurations - = Utils::filtered(target->runConfigurations(), [] (const RunConfiguration *rc) { + = Utils::filtered(target->runConfigurations(), [](const RunConfiguration *rc) { return !rc->runnable().command.isEmpty(); }); const ChoicePair oldChoice = AutotestPlugin::cachedChoiceFor(buildTargetKey); if (!oldChoice.executable.isEmpty()) { runConfig = Utils::findOrDefault(runConfigurations, - [&oldChoice] (const RunConfiguration *rc) { + [&oldChoice](const RunConfiguration *rc) { return oldChoice.matches(rc); }); if (runConfig) @@ -447,7 +446,7 @@ static RunConfiguration *getRunConfiguration(const QString &buildTargetKey) return nullptr; // run configuration has been selected - fill config based on this one.. const FilePath exe = FilePath::fromString(dialog.executable()); - runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) { + runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe](const RunConfiguration *rc) { if (rc->displayName() != dName) return false; return rc->runnable().command.executable() == exe; @@ -701,7 +700,7 @@ void TestRunner::runOrDebugTests() if (executablesEmpty()) { m_skipTargetsCheck = true; Target * target = SessionManager::startupTarget(); - QTimer::singleShot(5000, this, [this, target = QPointer(target)]() { + QTimer::singleShot(5000, this, [this, target = QPointer(target)] { if (target) { disconnect(target, &Target::buildSystemUpdated, this, &TestRunner::onBuildSystemUpdated); diff --git a/src/plugins/autotest/testsettingspage.cpp b/src/plugins/autotest/testsettingspage.cpp index eb45d1cad4b..38581a55a18 100644 --- a/src/plugins/autotest/testsettingspage.cpp +++ b/src/plugins/autotest/testsettingspage.cpp @@ -366,7 +366,7 @@ void TestSettingsPage::apply() return; const TestSettings newSettings = m_widget->settings(); const QList changedIds = Utils::filtered(newSettings.frameworksGrouping.keys(), - [newSettings, this] (const Utils::Id &id) { + [newSettings, this](const Utils::Id &id) { return newSettings.frameworksGrouping[id] != m_settings->frameworksGrouping[id]; }); *m_settings = newSettings; diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index cdb090461c5..b15c8f91346 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -70,7 +70,7 @@ void TestTreeModel::setupParsingConnections() m_parser->setState(TestCodeParser::Idle); SessionManager *sm = SessionManager::instance(); - connect(sm, &SessionManager::startupProjectChanged, [this, sm](Project *project) { + connect(sm, &SessionManager::startupProjectChanged, this, [this, sm](Project *project) { synchronizeTestFrameworks(); // we might have project settings m_parser->onStartupProjectChanged(project); removeAllTestToolItems(); @@ -568,7 +568,7 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b { TestTreeItem *parentNode = root; if (groupingEnabled && item->isGroupable()) { - parentNode = root->findFirstLevelChildItem([item] (const TestTreeItem *it) { + parentNode = root->findFirstLevelChildItem([item](const TestTreeItem *it) { return it->isGroupNodeFor(item); }); if (!parentNode) {