clang-tidy + any_of usage (#1171)

* [clang-tidy] change functions to static

Found with readability-convert-member-functions-to-static

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* optimize JsonWriter::validate #1171

* do the same for json_reader

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* use std::any_of

Also simplified two loops.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

Co-authored-by: Billy Donahue <billy.donahue@gmail.com>
This commit is contained in:
Rosen Penev
2020-05-12 16:19:36 -07:00
committed by GitHub
parent b8cb8889aa
commit e36cff19f0
3 changed files with 56 additions and 72 deletions

View File

@@ -3286,11 +3286,11 @@ struct CharReaderAllowDropNullTest : JsonTest::TestCase {
return [=](const Value& root) { JSONTEST_ASSERT_EQUAL(root, v); };
}
ValueCheck objGetAnd(std::string idx, ValueCheck f) {
static ValueCheck objGetAnd(std::string idx, ValueCheck f) {
return [=](const Value& root) { f(root.get(idx, true)); };
}
ValueCheck arrGetAnd(int idx, ValueCheck f) {
static ValueCheck arrGetAnd(int idx, ValueCheck f) {
return [=](const Value& root) { f(root[idx]); };
}
};