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

@@ -395,11 +395,10 @@ int TestResultModel::maxWidthOfLineNumber(const QFont &font)
int TestResultModel::resultTypeCount(ResultType type) const
{
int result = 0;
for (const auto &id : m_testResultCount.keys()) {
for (auto it = m_testResultCount.cbegin(); it != m_testResultCount.cend(); ++it) {
// if we got a result count from the framework prefer that over our counted results
int reported = m_reportedSummary[id].value(type);
result += reported != 0 ? reported : m_testResultCount.value(id).value(type);
int reported = m_reportedSummary[it.key()].value(type);
result += reported != 0 ? reported : it.value().value(type);
}
return result;
}