1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

cont. cleanup: remove superfluous std::string copies

This commit is contained in:
Philipp Otterbein 2024-10-07 01:05:17 +02:00
parent 4c0c8e5428
commit caf3b55891
6 changed files with 21 additions and 17 deletions

View file

@ -111,9 +111,7 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
auto manifestFile = ({
std::ostringstream str;
printAmbiguous(manifest, state.symbols, str, nullptr, std::numeric_limits<int>::max());
// TODO with C++20 we can use str.view() instead and avoid copy.
std::string str2 = str.str();
StringSource source { str2 };
StringSource source { str.view() };
state.store->addToStoreFromDump(
source, "env-manifest.nix", FileSerialisationMethod::Flat, ContentAddressMethod::Raw::Text, HashAlgorithm::SHA256, references);
});