forked from qt-creator/qt-creator
Don't use iterators to temporary containers
Fix a clazy warning, like: Don't call QVector::begin() on temporary [clazy-temporary-iterator] Indeed, we may pass begin and end iterators for 2 different instances of temporary vector (shared though). In addition: use const iterators. Change-Id: Iac1055d9fc226f1b48ca72ee4f3aab433addfe7f Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -166,15 +166,13 @@ void QmlPreviewPlugin::setLanguageLocale(const QString &locale)
|
||||
|
||||
QObject *QmlPreviewPlugin::getPreviewPlugin()
|
||||
{
|
||||
const QVector<ExtensionSystem::PluginSpec *> specs = ExtensionSystem::PluginManager::plugins();
|
||||
|
||||
auto pluginIt = std::find_if(specs.begin(),
|
||||
specs.end(),
|
||||
const QVector<ExtensionSystem::PluginSpec *> &specs = ExtensionSystem::PluginManager::plugins();
|
||||
const auto pluginIt = std::find_if(specs.cbegin(), specs.cend(),
|
||||
[](const ExtensionSystem::PluginSpec *p) {
|
||||
return p->name() == "QmlPreview";
|
||||
});
|
||||
|
||||
if (pluginIt != specs.end())
|
||||
if (pluginIt != specs.cend())
|
||||
return (*pluginIt)->plugin();
|
||||
|
||||
return nullptr;
|
||||
|
@@ -76,13 +76,13 @@
|
||||
namespace {
|
||||
QObject *getPreviewPlugin()
|
||||
{
|
||||
auto pluginIt = std::find_if(ExtensionSystem::PluginManager::plugins().begin(),
|
||||
ExtensionSystem::PluginManager::plugins().end(),
|
||||
const QVector<ExtensionSystem::PluginSpec *> &specs = ExtensionSystem::PluginManager::plugins();
|
||||
const auto pluginIt = std::find_if(specs.cbegin(), specs.cend(),
|
||||
[](const ExtensionSystem::PluginSpec *p) {
|
||||
return p->name() == "QmlPreview";
|
||||
});
|
||||
|
||||
if (pluginIt != ExtensionSystem::PluginManager::plugins().constEnd())
|
||||
if (pluginIt != specs.cend())
|
||||
return (*pluginIt)->plugin();
|
||||
|
||||
return nullptr;
|
||||
|
@@ -35,13 +35,12 @@
|
||||
|
||||
static bool isMultilanguagePresent()
|
||||
{
|
||||
const QVector<ExtensionSystem::PluginSpec *> specs = ExtensionSystem::PluginManager::plugins();
|
||||
return std::find_if(specs.begin(),
|
||||
specs.end(),
|
||||
const QVector<ExtensionSystem::PluginSpec *> &specs = ExtensionSystem::PluginManager::plugins();
|
||||
return std::find_if(specs.cbegin(), specs.cend(),
|
||||
[](ExtensionSystem::PluginSpec *spec) {
|
||||
return spec->name() == "MultiLanguage";
|
||||
})
|
||||
!= specs.end();
|
||||
!= specs.cend();
|
||||
}
|
||||
|
||||
static Utils::FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target *target)
|
||||
@@ -57,13 +56,13 @@ static Utils::FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target
|
||||
|
||||
static QObject *getPreviewPlugin()
|
||||
{
|
||||
auto pluginIt = std::find_if(ExtensionSystem::PluginManager::plugins().begin(),
|
||||
ExtensionSystem::PluginManager::plugins().end(),
|
||||
const QVector<ExtensionSystem::PluginSpec *> &specs = ExtensionSystem::PluginManager::plugins();
|
||||
const auto pluginIt = std::find_if(specs.cbegin(), specs.cend(),
|
||||
[](const ExtensionSystem::PluginSpec *p) {
|
||||
return p->name() == "QmlPreview";
|
||||
});
|
||||
|
||||
if (pluginIt != ExtensionSystem::PluginManager::plugins().constEnd())
|
||||
if (pluginIt != specs.cend())
|
||||
return (*pluginIt)->plugin();
|
||||
|
||||
return nullptr;
|
||||
|
Reference in New Issue
Block a user