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

Remove some pointless std::visit

These are not needed, because the `toJSON` methods are already
implemented for the variant wrapper too.
This commit is contained in:
John Ericson 2025-09-23 13:58:02 -04:00
parent d9de675357
commit 1c71cb4005

View file

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