From e1310ad43c0d29adbe652bb140bd699d9ccf7eda Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 25 Sep 2026 20:19:43 +0200 Subject: [PATCH] Fix CI: resolve clang-tidy findings in the stream position tests (#5578) #5344 added two lines to unit-deserialization.cpp that clang-tidy reports: modernize-return-braced-init-list for the remaining() helper and readability-isolate-declaration for "json j1, j2, j3;". Signed-off-by: Niels Lohmann --- tests/src/unit-deserialization.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/src/unit-deserialization.cpp b/tests/src/unit-deserialization.cpp index 28359804b..4202644f6 100644 --- a/tests/src/unit-deserialization.cpp +++ b/tests/src/unit-deserialization.cpp @@ -1240,9 +1240,9 @@ TEST_CASE("deserialization") // the stream is left one byte too far after a number (and only after a // number). JSON_PRECISE_STREAM_POSITION changes this; see // unit-precise-stream-position.cpp. These checks pin the default. - const auto remaining = [](std::istream & is) + const auto remaining = [](std::istream & is) -> std::string { - return std::string(std::istreambuf_iterator(is), std::istreambuf_iterator()); + return {std::istreambuf_iterator(is), std::istreambuf_iterator()}; }; SECTION("the character after a number is consumed") @@ -1266,7 +1266,9 @@ TEST_CASE("deserialization") SECTION("comma-separated numbers can be read one by one") { std::istringstream ss("1,2,3"); - json j1, j2, j3; + json j1; + json j2; + json j3; ss >> j1 >> j2 >> j3; CHECK(j1 == 1); CHECK(j2 == 2);