From 6c28a2612364f12fef0020981d296391b3d36ab4 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 10 Oct 2026 05:49:44 +0200 Subject: [PATCH] Suppress bugprone-return-const-ref-from-parameter in key_for_message The reference is only passed to concat() within the full-expression that holds the key, like the similar helpers in binary_writer.hpp. Signed-off-by: Niels Lohmann --- include/nlohmann/json.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 6fa3cf98a..656ec2238 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3366,7 +3366,7 @@ public: template < typename KeyType, detail::enable_if_t < !std::is_constructible::value, int > = 0 > static const KeyType & key_for_message(const KeyType& key) { - return key; + return key; // NOLINT(bugprone-return-const-ref-from-parameter): the result is only passed to concat() within the full-expression that holds key } /// @brief checked array element access used by the at() overloads taking an index diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index d5a504619..4a2919bb6 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -31277,7 +31277,7 @@ public: template < typename KeyType, detail::enable_if_t < !std::is_constructible::value, int > = 0 > static const KeyType & key_for_message(const KeyType& key) { - return key; + return key; // NOLINT(bugprone-return-const-ref-from-parameter): the result is only passed to concat() within the full-expression that holds key } /// @brief checked array element access used by the at() overloads taking an index