1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 15:02:42 +01:00

Merge pull request #14055 from obsidiansystems/rm-pointless-std-visit

Remove some pointless `std::visit`
This commit is contained in:
Eelco Dolstra 2025-09-23 20:14:33 +02:00 committed by GitHub
commit 03440946cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,7 @@ static nlohmann::json derivedPathsToJSON(const DerivedPaths & paths, Store & sto
{
auto res = nlohmann::json::array();
for (auto & t : paths) {
std::visit([&](const auto & t) { res.push_back(t.toJSON(store)); }, t.raw());
res.push_back(t.toJSON(store));
}
return res;
}
@ -22,9 +22,7 @@ builtPathsWithResultToJSON(const std::vector<BuiltPathWithResult> & buildables,
{
auto res = nlohmann::json::array();
for (auto & b : buildables) {
std::visit(
[&](const auto & t) {
auto j = t.toJSON(store);
auto j = b.path.toJSON(store);
if (b.result) {
if (b.result->startTime)
j["startTime"] = b.result->startTime;
@ -36,8 +34,6 @@ builtPathsWithResultToJSON(const std::vector<BuiltPathWithResult> & buildables,
j["cpuSystem"] = ((double) b.result->cpuSystem->count()) / 1000000;
}
res.push_back(j);
},
b.path.raw());
}
return res;
}