Don't allocate unneeded temporary containers

Fix clazy warnings: allocating an unneeded temporary container
[clazy-container-anti-pattern]

Change-Id: I4b4c2c634eea650bbdf3c12d982a17f899fc94ec
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2020-12-08 15:41:46 +01:00
parent 93dd966ce2
commit cf010911f7
25 changed files with 118 additions and 93 deletions

View File

@@ -83,7 +83,9 @@ QVariant CtfStatisticsModel::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
QString title = m_data.keys().at(index.row());
auto it = m_data.cbegin();
std::advance(it, index.row());
const QString &title = it.key();
switch (role) {
case Qt::TextAlignmentRole:

View File

@@ -176,8 +176,9 @@ void CtfTraceManager::load(const QString &filename)
void CtfTraceManager::finalize()
{
bool userConsentToIgnoreDeepTraces = false;
for (qint64 tid: m_threadModels.keys()) {
if (m_threadModels[tid]->m_maxStackSize > 512) {
auto it = m_threadModels.begin();
while (it != m_threadModels.end()) {
if (it.value()->m_maxStackSize > 512) {
if (!userConsentToIgnoreDeepTraces) {
QMessageBox::StandardButton answer
= QMessageBox::question(Core::ICore::dialogParent(),
@@ -192,8 +193,10 @@ void CtfTraceManager::finalize()
break;
}
}
m_threadModels.remove(tid);
m_threadRestrictions.remove(tid);
m_threadRestrictions.remove(it.key());
it = m_threadModels.erase(it);
} else {
++it;
}
}
for (CtfTimelineModel *model: m_threadModels) {