Fix clang-tidy and -Wnrvo findings in insert rollback helpers

Declare the rollback helpers non-movable, replace the nested conditional
and C array in object_insert_rollback, silence the intentional copy in the
allocator test, and avoid the missed NRVO in the test factory lambda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude committed 2026-11-02 05:44:29 +00:00
1 parent c84e22cc62
commit 727a15c710
3 files changed
+40 -8

No files matched your search

+2 -2
View File
@@ -881,7 +881,7 @@ void check_strong_guarantee(const std::function<BasicJsonType()>& make,
{
CHECK(j.dump() == before);
CHECK(children_name_their_parent(j));
const BasicJsonType copy(j);
const BasicJsonType copy(j); // NOLINT(performance-unnecessary-copy-initialization): the copy is the point, it allocates
CHECK(copy.dump() == before);
}
}
@@ -917,7 +917,7 @@ void check_insert_strong_guarantee()
j.push_back(std::string(64, 'd'));
j.erase(3);
}
return j;
return json_t(std::move(j));
};
for (const bool at_end :