From 86bb7c98e402897f6e1f615a1e37ed300f4665a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 24 Nov 2023 18:45:48 +0100 Subject: [PATCH] enabled and mitigated `readability-const-return-type` clang-tidy warnings (#5644) --- .clang-tidy | 1 - clang-tidy.md | 1 - gui/test/translationhandler/testtranslationhandler.cpp | 2 +- lib/standards.h | 2 +- lib/utils.h | 1 + 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index e96c20ed6dd..b0f8a59348f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -59,7 +59,6 @@ Checks: > -portability-std-allocator-const, -readability-avoid-const-params-in-decls, -readability-braces-around-statements, - -readability-const-return-type, -readability-container-data-pointer, -readability-function-cognitive-complexity, -readability-function-size, diff --git a/clang-tidy.md b/clang-tidy.md index 1b9c0aef180..a1abd9a5f5c 100644 --- a/clang-tidy.md +++ b/clang-tidy.md @@ -118,7 +118,6 @@ Also reports a false positive about templates which deduce the array length: htt We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as the findings of the include checkers still need to be reviewed manually before applying them. `bugprone-branch-clone`
-`readability-const-return-type`
`modernize-return-braced-init-list`
`misc-throw-by-value-catch-by-reference`
`readability-avoid-const-params-in-decls`
diff --git a/gui/test/translationhandler/testtranslationhandler.cpp b/gui/test/translationhandler/testtranslationhandler.cpp index f6a925c6b1a..7abb1c8f7c0 100644 --- a/gui/test/translationhandler/testtranslationhandler.cpp +++ b/gui/test/translationhandler/testtranslationhandler.cpp @@ -24,7 +24,7 @@ #include #include -static const QStringList getTranslationNames(const TranslationHandler& handler) +static QStringList getTranslationNames(const TranslationHandler& handler) { QStringList names; for (const TranslationInfo& translation : handler.getTranslations()) { diff --git a/lib/standards.h b/lib/standards.h index f22cd76329a..619ce623594 100644 --- a/lib/standards.h +++ b/lib/standards.h @@ -59,7 +59,7 @@ struct Standards { } return false; } - const std::string getC() const { + std::string getC() const { switch (c) { case C89: return "c89"; diff --git a/lib/utils.h b/lib/utils.h index d5721574abf..9d11a68e983 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -36,6 +36,7 @@ struct SelectMapKeys { template + // NOLINTNEXTLINE(readability-const-return-type) - false positive typename Pair::first_type operator()(const Pair& p) const { return p.first; }