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:
parent
d9de675357
commit
1c71cb4005
1 changed files with 13 additions and 17 deletions
|
|
@ -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,22 +22,18 @@ 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) {
|
if (b.result) {
|
||||||
auto j = t.toJSON(store);
|
if (b.result->startTime)
|
||||||
if (b.result) {
|
j["startTime"] = b.result->startTime;
|
||||||
if (b.result->startTime)
|
if (b.result->stopTime)
|
||||||
j["startTime"] = b.result->startTime;
|
j["stopTime"] = b.result->stopTime;
|
||||||
if (b.result->stopTime)
|
if (b.result->cpuUser)
|
||||||
j["stopTime"] = b.result->stopTime;
|
j["cpuUser"] = ((double) b.result->cpuUser->count()) / 1000000;
|
||||||
if (b.result->cpuUser)
|
if (b.result->cpuSystem)
|
||||||
j["cpuUser"] = ((double) b.result->cpuUser->count()) / 1000000;
|
j["cpuSystem"] = ((double) b.result->cpuSystem->count()) / 1000000;
|
||||||
if (b.result->cpuSystem)
|
}
|
||||||
j["cpuSystem"] = ((double) b.result->cpuSystem->count()) / 1000000;
|
res.push_back(j);
|
||||||
}
|
|
||||||
res.push_back(j);
|
|
||||||
},
|
|
||||||
b.path.raw());
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue