From ff1981fcdce0d2acf138f5b7840a394fe550d71b Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 18 Aug 2023 00:49:06 +0200 Subject: [PATCH] Lint: fix several issues discovered by clazy --- src/App/Graphviz.cpp | 10 +++++----- src/Base/Rotation.cpp | 1 - src/Gui/DocumentModel.cpp | 4 ++-- src/Gui/NotificationArea.cpp | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/App/Graphviz.cpp b/src/App/Graphviz.cpp index 351e41b91f..d8183bb4ce 100644 --- a/src/App/Graphviz.cpp +++ b/src/App/Graphviz.cpp @@ -399,11 +399,11 @@ void Document::exportGraphviz(std::ostream& out) const } // Internal document objects - for (auto It : d->objectMap) + for (const auto & It : d->objectMap) addExpressionSubgraphIfNeeded(It.second, CSSubgraphs); // Add external document objects - for (auto it : d->objectMap) { + for (const auto & it : d->objectMap) { std::vector OutList = it.second->getOutList(); for (auto obj : OutList) { if (obj) { @@ -424,11 +424,11 @@ void Document::exportGraphviz(std::ostream& out) const bool CSSubgraphs = depGrp->GetBool("GeoFeatureSubgraphs", true); // Add internal document objects - for (auto It : d->objectMap) + for (const auto & It : d->objectMap) add(It.second, It.second->getNameInDocument(), It.second->Label.getValue(), CSSubgraphs); // Add external document objects - for (auto It : d->objectMap) { + for (const auto & It : d->objectMap) { std::vector OutList = It.second->getOutList(); for (auto obj : OutList) { if (obj) { @@ -484,7 +484,7 @@ void Document::exportGraphviz(std::ostream& out) const bool omitGeoFeatureGroups = depGrp->GetBool("GeoFeatureSubgraphs", true); // Add edges between document objects - for (auto It : d->objectMap) { + for (const auto & It : d->objectMap) { if(omitGeoFeatureGroups) { //coordinate systems are represented by subgraphs diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 23c57cbbb1..a484c71b6d 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -842,7 +842,6 @@ struct EulerSequence_Parameters EulerSequence_Parameters translateEulerSequence (const Rotation::EulerSequence theSeq) { - using Params = EulerSequence_Parameters; const bool F = false; const bool T = true; diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index c254b6253c..2020f5741a 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -489,7 +489,7 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj, auto doc_index = static_cast(d->rootItem->child(row)); QList views; doc_index->findViewProviders(obj, views); - for (const auto & view : views) { + for (const auto & view : qAsConst(views)) { DocumentModelIndex* parentitem = view->parent(); QModelIndex parent = createIndex(0,0,parentitem); int row = view->row(); @@ -523,7 +523,7 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj, // get all occurrences of the view provider in the tree structure QList obj_index; doc_index->findViewProviders(obj, obj_index); - for (const auto & it : obj_index) { + for (const auto & it : qAsConst(obj_index)) { QModelIndex parent = createIndex(it->row(),0,it); int count_obj = it->childCount(); beginRemoveRows(parent, 0, count_obj); diff --git a/src/Gui/NotificationArea.cpp b/src/Gui/NotificationArea.cpp index 6f81d656b5..1be348075b 100644 --- a/src/Gui/NotificationArea.cpp +++ b/src/Gui/NotificationArea.cpp @@ -382,7 +382,7 @@ public: ~NotificationsAction() override { - for (auto* item : pushedItems) { + for (auto* item : qAsConst(pushedItems)) { if (item) { delete item; } @@ -572,7 +572,7 @@ protected: QMenu menu; QAction* del = menu.addAction(tr("Delete"), this, [&]() { - for (auto it : selectedItems) { + for (auto it : qAsConst(selectedItems)) { delete it; } });