1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 11:11:03 -04:00

Optimize ValidPathInfo construction a bit better

This commit is contained in:
John Ericson 2023-01-06 12:26:15 -05:00
parent 6a168254ce
commit 9cfa78e58a

View file

@ -1340,13 +1340,13 @@ ValidPathInfo::ValidPathInfo(
, narHash(narHash)
{
std::visit(overloaded {
[this](const TextInfo & ti) {
this->references = ti.references;
this->ca = TextHash { std::move(ti) };
[this](TextInfo && ti) {
this->references = std::move(ti.references);
this->ca = std::move((TextHash &&) ti);
},
[this](const FixedOutputInfo & foi) {
*(static_cast<PathReferences<StorePath> *>(this)) = foi.references;
this->ca = FixedOutputHash { (FixedOutputHash) std::move(foi) };
[this](FixedOutputInfo && foi) {
*(static_cast<PathReferences<StorePath> *>(this)) = std::move(foi.references);
this->ca = std::move((FixedOutputHash &&) foi);
},
}, std::move(info.info));
}