From 3dce62b5f707fbbb6dc497e73214574b282cf542 Mon Sep 17 00:00:00 2001 From: Jonas Wittbrodt Date: Wed, 25 Aug 2021 15:31:09 +0200 Subject: [PATCH] fix clang-tidy else after return + add test case that triggers fallthrough in from_json + re-amalgamate --- include/nlohmann/detail/conversions/from_json.hpp | 4 ++-- single_include/nlohmann/json.hpp | 4 ++-- test/src/unit-conversions.cpp | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index ce37730c8..8d7638898 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -65,7 +65,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; @@ -371,7 +371,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 6f3753cf3..c0ec74782 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3928,7 +3928,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; @@ -4234,7 +4234,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index 5983c4450..459cfc3e1 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -936,6 +936,7 @@ TEST_CASE("value conversion") { CHECK_THROWS_AS(json(json::value_t::null).get(), json::type_error&); + CHECK_THROWS_AS(json(json::value_t::null).get(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::object).get(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::array).get(),