mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Fixed clazy warnings: unnecessary containers and containers being detached in range-for loops.
This commit is contained in:
@@ -352,11 +352,11 @@ namespace BlackMisc
|
||||
{
|
||||
const QMap<QString, int> modelStrings = this->countPerModelString();
|
||||
CAircraftModelList duplicates;
|
||||
for (const QString &ms : modelStrings.keys())
|
||||
for (const auto &pair : makePairsRange(modelStrings))
|
||||
{
|
||||
if (modelStrings[ms] > 1)
|
||||
if (pair.second > 1)
|
||||
{
|
||||
duplicates.push_back(this->findByModelString(ms, Qt::CaseInsensitive));
|
||||
duplicates.push_back(this->findByModelString(pair.first, Qt::CaseInsensitive));
|
||||
}
|
||||
}
|
||||
return duplicates;
|
||||
|
||||
@@ -62,9 +62,9 @@ namespace BlackMisc
|
||||
{
|
||||
const SetupsPerCallsign setups = this->getSetupsPerCallsign();
|
||||
CCallsignSet callsigns;
|
||||
for (const CCallsign &cs : setups.keys())
|
||||
for (const auto &pair : makePairsRange(setups))
|
||||
{
|
||||
if (setups.value(cs).logInterpolation()) { callsigns.insert(cs); }
|
||||
if (pair.second.logInterpolation()) { callsigns.insert(pair.first); }
|
||||
}
|
||||
return callsigns;
|
||||
}
|
||||
@@ -146,19 +146,19 @@ namespace BlackMisc
|
||||
|
||||
void IInterpolationSetupProvider::clearInterpolationLogCallsigns()
|
||||
{
|
||||
SetupsPerCallsign setupsCopy = this->getSetupsPerCallsign();
|
||||
const SetupsPerCallsign setupsCopy = this->getSetupsPerCallsign();
|
||||
if (setupsCopy.isEmpty()) { return; }
|
||||
|
||||
// potential risk, changes inbetween in another thread are missed now
|
||||
// on the other side, we keep locks for a minimal time frame
|
||||
SetupsPerCallsign setupsToKeep;
|
||||
CInterpolationAndRenderingSetupGlobal global = this->getInterpolationSetupGlobal();
|
||||
for (const CCallsign &cs : setupsCopy.keys())
|
||||
for (const auto &pair : makePairsRange(setupsCopy))
|
||||
{
|
||||
CInterpolationAndRenderingSetupPerCallsign setup = setupsCopy.value(cs);
|
||||
CInterpolationAndRenderingSetupPerCallsign setup = pair.second;
|
||||
setup.setLogInterpolation(false);
|
||||
if (setup.isEqualToGlobal(global)) { continue; }
|
||||
setupsToKeep.insert(cs, setup);
|
||||
setupsToKeep.insert(pair.first, setup);
|
||||
}
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
@@ -184,9 +184,9 @@ namespace BlackMisc
|
||||
{
|
||||
const SetupsPerCallsign setupsCopy = this->getSetupsPerCallsign();
|
||||
if (setupsCopy.isEmpty()) { return false; }
|
||||
for (const CCallsign &cs : setupsCopy.keys())
|
||||
for (const CInterpolationAndRenderingSetupPerCallsign &setup : setupsCopy)
|
||||
{
|
||||
if (setupsCopy.value(cs).logInterpolation()) { return true; }
|
||||
if (setup.logInterpolation()) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user