From 7db1711b09a88919ba24acd3ae010fd5faa479a4 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 5 Jan 2025 15:48:26 +0100 Subject: [PATCH] Bump clazy version --- .gitlab-ci.yml | 4 ++-- src/JdenticonProvider.h | 2 +- src/MainWindow.cpp | 3 ++- src/MxcImageProvider.cpp | 2 +- src/timeline/InputBar.cpp | 4 ++-- src/timeline/InputBar.h | 2 +- src/timeline/RoomlistModel.cpp | 16 ++++++++-------- src/timeline/TimelineModel.h | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 232fc6a2..215393ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -120,11 +120,11 @@ build-clazy: CLAZY_CHECKS: level0,level1,no-non-pod-global-static TRAVIS_OS_NAME: linux before_script: - - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev + - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang18 gcc musl-dev git re2-dev libsecret-dev script: - export PATH="/usr/lib/ccache:${PATH}" - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) - - export CLANGXX=clang++-16 + - export CLANGXX=clang++-18 - cmake -GNinja -H. -Bbuild -DCMAKE_INSTALL_PREFIX=.deps/usr -DHUNTER_ENABLED=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_COEURL=ON -DUSE_BUNDLED_OLM=ON -DUSE_BUNDLED_QTKEYCHAIN=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON diff --git a/src/JdenticonProvider.h b/src/JdenticonProvider.h index f13efc46..ba7c5023 100644 --- a/src/JdenticonProvider.h +++ b/src/JdenticonProvider.h @@ -69,7 +69,7 @@ public slots: auto query = id.mid(queryStart + 1); auto queryBits = QStringView(query).split('&'); - for (const auto &b : queryBits) { + for (const auto &b : std::as_const(queryBits)) { if (b.startsWith(QStringView(u"radius="))) { radius = b.mid(7).toDouble(); } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 42a1521d..ffa7bd2a 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -203,7 +203,8 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event) // reason?!? if (event->type() == QEvent::ChildAdded && obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) { - for (const auto window : QGuiApplication::topLevelWindows()) { + auto windows = QGuiApplication::topLevelWindows(); + for (const auto window : std::as_const(windows)) { if (window->property("posted").isValid()) continue; QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange)); diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp index e0afdcbf..fee6f360 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp @@ -91,7 +91,7 @@ MxcImageProvider::requestImageResponse(const QString &id, const QSize &requested auto query = QStringView(id).mid(queryStart + 1); auto queryBits = query.split('&'); - for (auto b : queryBits) { + for (auto b : std::as_const(queryBits)) { if (b == QStringView(u"scale")) { crop = false; } else if (b.startsWith(QStringView(u"radius="))) { diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index e33c9711..1e587d6d 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -494,11 +494,11 @@ InputBar::generateRelations() const } mtx::common::Mentions -InputBar::generateMentions() +InputBar::generateMentions() const { std::vector userMentions; bool atRoom = false; - for (const auto &m : mentions_) + for (const auto &m : std::as_const(mentions_)) if (m == u"@room") atRoom = true; else diff --git a/src/timeline/InputBar.h b/src/timeline/InputBar.h index 5e885d4f..9ee2accf 100644 --- a/src/timeline/InputBar.h +++ b/src/timeline/InputBar.h @@ -304,7 +304,7 @@ private: QPair getCommandAndArgs() const { return getCommandAndArgs(text()); } QPair getCommandAndArgs(const QString ¤tText) const; mtx::common::Relations generateRelations() const; - mtx::common::Mentions generateMentions(); + mtx::common::Mentions generateMentions() const; void startUploadFromPath(const QString &path); void startUploadFromMimeData(const QMimeData &source, const QString &format); diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index 4cc50fee..b4b18008 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -1014,7 +1014,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags) .toStringList(); - for (const auto &t : tags) + for (const auto &t : std::as_const(tags)) if (hiddenTags.contains(t)) return false; } @@ -1023,7 +1023,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons auto parents = sourceModel() ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces) .toStringList(); - for (const auto &t : parents) + for (const auto &t : std::as_const(parents)) if (hiddenSpaces.contains(t)) return false; } @@ -1053,7 +1053,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags) .toStringList(); - for (const auto &t : tags) + for (const auto &t : std::as_const(tags)) if (hiddenTags.contains(t)) return false; } @@ -1062,7 +1062,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons auto parents = sourceModel() ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces) .toStringList(); - for (const auto &t : parents) + for (const auto &t : std::as_const(parents)) if (hiddenSpaces.contains(t)) return false; } @@ -1091,7 +1091,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons return false; if (!hiddenTags.empty()) { - for (const auto &t : tags) + for (const auto &t : std::as_const(tags)) if (t != filterStr && hiddenTags.contains(t)) return false; } @@ -1100,7 +1100,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons auto parents = sourceModel() ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces) .toStringList(); - for (const auto &t : parents) + for (const auto &t : std::as_const(parents)) if (hiddenSpaces.contains(t)) return false; } @@ -1130,13 +1130,13 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons ->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags) .toStringList(); - for (const auto &t : tags) + for (const auto &t : std::as_const(tags)) if (hiddenTags.contains(t)) return false; } if (!hiddenSpaces.empty()) { - for (const auto &t : parents) + for (const auto &t : std::as_const(parents)) if (t != filterStr && hiddenSpaces.contains(t)) return false; } diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 9f96c62d..c57956e6 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -360,7 +360,7 @@ public: auto list = events.reactions(event_id); std::vector<::Reaction> vec; vec.reserve(list.size()); - for (const auto &r : list) + for (const auto &r : std::as_const(list)) vec.push_back(r.value()); return vec; }