mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
Fixed clazy warnings: unnecessary containers and containers being detached.
This commit is contained in:
@@ -218,7 +218,7 @@ namespace BlackMisc
|
||||
CSpeed guessedVRotate = this->isVtol() ? CSpeed::null() : CSpeed(70, CSpeedUnit::km_h());
|
||||
|
||||
const int engines = this->getEnginesCount();
|
||||
const QChar engineType = this->getEngineType()[0].toUpper();
|
||||
const QChar engineType = this->getEngineType().at(0).toUpper();
|
||||
do
|
||||
{
|
||||
if (engines == 1)
|
||||
|
||||
@@ -719,7 +719,7 @@ namespace BlackMisc
|
||||
QMutexLocker lock(&m_mutex);
|
||||
|
||||
Q_ASSERT(! m_updateInProgress);
|
||||
m_sessionValues[key]; // insert default-constructed value, unless key already present
|
||||
m_sessionValues[key]; // clazy:exclude=detaching-member
|
||||
}
|
||||
|
||||
QJsonObject CDataCacheRevision::toJson(const QMap<QString, qint64> ×tamps)
|
||||
|
||||
@@ -498,8 +498,8 @@ namespace BlackMisc
|
||||
// - type
|
||||
// - value
|
||||
if (object.size() != 1) { return object; } // no cache format
|
||||
const QString key = object.keys().front();
|
||||
const QJsonObject cacheObject = object.value(key).toObject();
|
||||
const QString key = object.constBegin().key();
|
||||
const QJsonObject cacheObject = object.constBegin()->toObject();
|
||||
if (cacheObject.contains("type") && cacheObject.contains("value"))
|
||||
{
|
||||
const QString type = cacheObject.value("type").toString(); // just to verify in debugger
|
||||
@@ -512,8 +512,8 @@ namespace BlackMisc
|
||||
QJsonObject unwrapCache(const QJsonObject &object)
|
||||
{
|
||||
if (object.size() != 1) { return object; } // no cache format
|
||||
const QString key = object.keys().front();
|
||||
const QJsonObject cacheObject = object.value(key).toObject();
|
||||
const QString key = object.constBegin().key();
|
||||
const QJsonObject cacheObject = object.constBegin()->toObject();
|
||||
if (cacheObject.contains("type") && cacheObject.contains("value"))
|
||||
{
|
||||
// return object in form type/value
|
||||
|
||||
@@ -82,8 +82,8 @@ namespace BlackMisc
|
||||
auto finder = [ & ](const PatternPair &pair) { return pair.first == pattern; };
|
||||
auto comparator = [](const PatternPair &a, const PatternPair &b) { return a.first.isProperSubsetOf(b.first); };
|
||||
|
||||
auto it = std::find_if(m_patternHandlers.begin(), m_patternHandlers.end(), finder);
|
||||
if (it == m_patternHandlers.end())
|
||||
auto it = std::find_if(m_patternHandlers.cbegin(), m_patternHandlers.cend(), finder);
|
||||
if (it == m_patternHandlers.cend())
|
||||
{
|
||||
auto *handler = new CLogPatternHandler(this, pattern);
|
||||
topologicallySortedInsert(m_patternHandlers, PatternPair(pattern, handler), comparator);
|
||||
|
||||
@@ -537,7 +537,7 @@ namespace BlackMisc
|
||||
{
|
||||
static const QString empty;
|
||||
if (this->getModelDirectoriesOrDefault().isEmpty()) { return empty; }
|
||||
return this->getModelDirectoriesOrDefault().first();
|
||||
return this->getModelDirectoriesOrDefault().constFirst();
|
||||
}
|
||||
|
||||
const QStringList &CSpecializedSimulatorSettings::getDefaultModelDirectories() const
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace BlackMisc
|
||||
if (simulator.isNoSimulator() || simulator.isUnspecified())
|
||||
{
|
||||
// unknown count
|
||||
m_counts[5] = m_counts[5] + 1;
|
||||
m_counts[5]++;
|
||||
return;
|
||||
}
|
||||
if (simulator.isFSX()) { m_counts[0]++; }
|
||||
|
||||
Reference in New Issue
Block a user