🚨 fixed some linter warnings

This commit is contained in:
Niels Lohmann 2018-10-06 13:49:02 +02:00
parent f1768a540a
commit ec95438a59
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
5 changed files with 10 additions and 10 deletions

View file

@ -306,7 +306,7 @@ void to_json(BasicJsonType& j, const std::pair<Args...>& p)
// for https://github.com/nlohmann/json/pull/1134 // for https://github.com/nlohmann/json/pull/1134
template<typename BasicJsonType, typename T, template<typename BasicJsonType, typename T,
enable_if_t<std::is_same<T, typename iteration_proxy<typename BasicJsonType::iterator>::iteration_proxy_internal>::value, int> = 0> enable_if_t<std::is_same<T, typename iteration_proxy<typename BasicJsonType::iterator>::iteration_proxy_internal>::value, int> = 0>
void to_json(BasicJsonType& j, T b) noexcept void to_json(BasicJsonType& j, const T& b)
{ {
j = {{b.key(), b.value()}}; j = {{b.key(), b.value()}};
} }

View file

@ -709,7 +709,7 @@ class lexer
locale's decimal point is used instead of `.` to work with the locale's decimal point is used instead of `.` to work with the
locale-dependent converters. locale-dependent converters.
*/ */
token_type scan_number() token_type scan_number() // lgtm [cpp/use-of-goto]
{ {
// reset token_buffer to store the number's bytes // reset token_buffer to store the number's bytes
reset(); reset();

View file

@ -506,11 +506,11 @@ class json_pointer
std::size_t slash = reference_string.find_first_of('/', 1), std::size_t slash = reference_string.find_first_of('/', 1),
// set the beginning of the first reference token // set the beginning of the first reference token
start = 1; start = 1;
// we can stop if start == string::npos+1 = 0 // we can stop if start == 0 (if slash == std::string::npos)
start != 0; start != 0;
// set the beginning of the next reference token // set the beginning of the next reference token
// (will eventually be 0 if slash == std::string::npos) // (will eventually be 0 if slash == std::string::npos)
start = slash + 1, start = (slash == std::string::npos) ? 0 : slash + 1,
// find next slash // find next slash
slash = reference_string.find_first_of('/', start)) slash = reference_string.find_first_of('/', start))
{ {

View file

@ -442,7 +442,7 @@ class serializer
return; return;
} }
const bool is_negative = not (x >= 0); // see issue #755 const bool is_negative = std::is_same<NumberType, number_integer_t>::value and not (x >= 0); // see issue #755
std::size_t i = 0; std::size_t i = 0;
while (x != 0) while (x != 0)

View file

@ -1839,7 +1839,7 @@ void to_json(BasicJsonType& j, const std::pair<Args...>& p)
// for https://github.com/nlohmann/json/pull/1134 // for https://github.com/nlohmann/json/pull/1134
template<typename BasicJsonType, typename T, template<typename BasicJsonType, typename T,
enable_if_t<std::is_same<T, typename iteration_proxy<typename BasicJsonType::iterator>::iteration_proxy_internal>::value, int> = 0> enable_if_t<std::is_same<T, typename iteration_proxy<typename BasicJsonType::iterator>::iteration_proxy_internal>::value, int> = 0>
void to_json(BasicJsonType& j, T b) noexcept void to_json(BasicJsonType& j, const T& b)
{ {
j = {{b.key(), b.value()}}; j = {{b.key(), b.value()}};
} }
@ -2976,7 +2976,7 @@ class lexer
locale's decimal point is used instead of `.` to work with the locale's decimal point is used instead of `.` to work with the
locale-dependent converters. locale-dependent converters.
*/ */
token_type scan_number() token_type scan_number() // lgtm [cpp/use-of-goto]
{ {
// reset token_buffer to store the number's bytes // reset token_buffer to store the number's bytes
reset(); reset();
@ -10157,7 +10157,7 @@ class serializer
return; return;
} }
const bool is_negative = not (x >= 0); // see issue #755 const bool is_negative = std::is_same<NumberType, number_integer_t>::value and not (x >= 0); // see issue #755
std::size_t i = 0; std::size_t i = 0;
while (x != 0) while (x != 0)
@ -10922,11 +10922,11 @@ class json_pointer
std::size_t slash = reference_string.find_first_of('/', 1), std::size_t slash = reference_string.find_first_of('/', 1),
// set the beginning of the first reference token // set the beginning of the first reference token
start = 1; start = 1;
// we can stop if start == string::npos+1 = 0 // we can stop if start == 0 (if slash == std::string::npos)
start != 0; start != 0;
// set the beginning of the next reference token // set the beginning of the next reference token
// (will eventually be 0 if slash == std::string::npos) // (will eventually be 0 if slash == std::string::npos)
start = slash + 1, start = (slash == std::string::npos) ? 0 : slash + 1,
// find next slash // find next slash
slash = reference_string.find_first_of('/', start)) slash = reference_string.find_first_of('/', start))
{ {